What is wrong with this? The rate will never increase!?Code:#include<stdio.h> #include<windows.h> #include<stdlib.h> main(){ int book = 0, write = 0, research = 0, start, lev = 1, cmd; float money = 0, rate = 0; printf ("Before we start how much money do you want to play for? (No Decimal):"); scanf ("%d", &start); printf ("This is a simple program designed after learning to code\n"); printf ("Your Objective is to make %d dollars. In order to get this much money you will have 3 skills\reading, writing, and research. \nIn order to grow in these skills you will have to complete those tasks.\nNow in order to make money you need to use your skills to write a program, \nthen sell it the amount of money you make will be determined by your skill level.\nIn order to grow in skill you must have 1 level \nmore in reading, writing, and reasearch than your level.", start); while (1){ if (money==start) { printf ("you win"); return 0;} switch (lev) { case 2: rate=rate+10;break; case 3: rate=rate+20;break; case 4: rate=rate+30;break; case 5: rate=rate+40;break; case 6: rate=rate+50;break; case 7: rate=rate+60;break; case 8: rate=rate+70;break; case 9: rate=rate+80;break; case 10: rate=rate+90;break; case 11: rate=rate+100;break; } if (book==1 && write==1 && research==1) lev++; if (book==2 && write==2 && research==2) lev++; if (book==3 && write==3 && research==3) lev++; if (book==4 && write==4 && research==4) lev++; if (book==5 && write==5 && research==5) lev++; if (book==6 && write==6 && research==6) lev++; if (book==7 && write==7 && research==7) lev++; if (book==8 && write==8 && research==8) lev++; if (book==9 && write==9 && research==9) lev++; if (book==10 && write==10 && research==10) lev++; if (book==11 && write==11 && research==11) lev++; if (book==12 && write==12 && research==12) lev++; printf("\nYou have 5 commands to choose from: 1.Stats, 2.Read, 3.Write, 4.Research, 5.Game (Writes for money)."); printf("Insert Command #: "); scanf("%d", &cmd); if (cmd == 1) { printf("Stats:\n\nReading: %d\nWrite: %d\nResearch: %d\nLevel: %d\nRate: %.0f\nMoney: %.2f", book, write, research, lev, rate, money); continue; } if (cmd == 2) { printf("Reading. . . . . ."); book++; sleep (10000); continue; } if (cmd == 3) { printf("Writing. . . . . ."); write++; sleep (10000); continue;} if (cmd == 4) { printf("Researching. . . ."); research++; sleep (10000); continue;} if (cmd == 5) { printf("Selling. . . . . .(Takes Longer)"); sleep (50000); money = money + rate; continue; } } getchar(); return 0; }



LinkBack URL
About LinkBacks


