_NIKOS_ Δημοσιεύτηκε October 20, 2008 Κοινοποίηση Δημοσιεύτηκε October 20, 2008 Kalispera exo na paradoso to akoloutho programma se C, ta exo ola etoima kai to mono pou den mporo na kano einai na kalo pros emfanisi tis times pou exei dosei o xristis, an mporei kapoios na mou peis pos ginete gt logika kati kano lathos, an to parete kai to balete se enan editor na treksei tha katalabete to sfalma. Euxaristo filika NIKOS. To programmaeinai to ekseis: #include <stdio.h> int main() { int elipsi[10], i=0, w=0, q=0, k=0; float timi[10], aksia[11], temp=0, pos=0, sto=0, per=0, cod=0; struct trofima { char* code; char* perigrafi; float timi; int posotita; int stock; }; struct trofima apothiki[10]; for (k=1; k<=10; k++) { printf("\n"); printf("\nDose ton kodiko tou (%dou) proiontos -> ", k); fflush(stdin); scanf("%ss\n", &cod); apothiki[k].code='cod'; printf("Dose tin perigrafi tou (%dou) proiontos -> ", k); fflush(stdin); scanf("%ss\n", &per); apothiki[k].perigrafi='per'; printf("Dose tin timi tou (%dou) proiontos -> ", k); fflush(stdin); scanf("%ff\n", &temp); apothiki[k].timi=temp; printf("Dose tin posotita tou (%dou) proiontos -> ", k); fflush(stdin); scanf("%dd\n", &pos); apothiki[k].posotita=pos; printf("Dose to stock tou (%dou) proiontos -> ", k); fflush(stdin); scanf("%dd\n", &sto); apothiki[k].stock=sto; } printf(" Stin apothiki exoun apomeinei oi ekseis posotites:\n"); printf("\n"); for (q=0; q<=9; q++) { printf(" Proion (%s) me kodiko (%s), me timi (%.2f), me posotita (%d) kai me stock (%d)\n",apothiki[q].perigrafi, apothiki[q].code, apothiki[q].timi, apothiki[q].posotita, apothiki[q].stock); } printf("________________________________________________________________________________\n "); for (i=0; i<=9; i++) { aksia=apothiki.posotita*apothiki.timi; printf(" H sinoliki aksia tou proiontos (%s) einai -> %.2f euro\n", apothiki.perigrafi, aksia); } aksia[10]=(aksia[0]+aksia[1]+aksia[2]+aksia[3]+aksia[4]+aksia[5]+aksia[6]+aksia[7]+aksia[8]+aksia[9]); printf("\n"); printf(" ***** H sinoliki aksia olis tis apothikis einai -> %.2f euro *****\n", aksia[10]); printf("________________________________________________________________________________\n "); printf(" Oi paraggeleies pou prepei na ginoun einai oi ekseis:\n"); printf("\n"); for (w=0; w<=9; w++) { elipsi[w]=(apothiki[w].stock-apothiki[w].posotita); timi[w]=elipsi[w]*apothiki[w].timi; printf(" Apo to proion (%s) uparxei elipsi -> %d tem. ta opoia kostizoun -> %.2f euro\n", apothiki[w].perigrafi, elipsi[w], timi[w]); } system("pause"); return 0; } Παράθεση Link to comment Share on other sites Περισσότερες Επιλογές Κοινής Χρήσης
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.