Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
- AuthorPosts
- AnnelieSchoenheParticipant
Wait, so the first else after the initial if should be if followed by a else Which is the second else in the statement right?
123456789101112if(exit=3)<br />{.....<br />}<br /><br />//This is where i'm confused<br />//This is where the else if should be first right? Then an else should be right after it?<br />else if(exit==23){<br />...<br />}<br />else(exit==46){<br />...<br />}And even after that, i still recive errors up the ass. I built this code form the floor. How did these codes slip past?
AnnelieSchoenheParticipantBefore i start, i fortunetly was able to fix the Linker errors. I fear i may have more of them later, but when that time comes, i’ll fix them. Now i have new errors.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122//A basic two in one program used for studying functions and arithmatic.<br />//Created by Deathscreton on 5:08 PM 3/20/09<br />#include <stdio.h><br /><br />addition()<br />{ do<br />{<br />char counter,addy,back,exit,yes,no;<br />int count;<br />int a;<br />int b;<br />int sum;<br />count=0;<br />counter='d';<br />addy='g';<br />back='f';<br />exit='k';<br />yes='n';<br />++count;<br /><br />printf("Please enter the first number: n");<br />scanf("%d",&a);<br />printf("You've entered %d, is this correct? Y for yes, n for no.",a);<br />scanf("%c %c",&yes, &no);<br />if (yes=='y')<br />{<br />printf("Please enter the second number: n");<br />scanf("%d",&b);<br />printf("You've entered %d, is this correct? y for yes, n for no.",b);<br />scanf("%c %c",&yes, &no);<br />if (yes=='y')<br />{<br />sum=a+b;<br />printf("The answer of the numbers entered is %d. Would you like to run this again?",sum);<br />scanf("%c %c",&yes, &no);<br />if (yes=='y')<br />{<br />addition();<br />}<br />else (no=='n');<br />{<br />main();}<br />}<br />else (no=='n');<br />{<br />addition();<br />}<br />}<br />}while (count < 48793);<br /><br />}<br /><br /><br /><br />counting()<br />{<br /><br />do<br />{<br />int count;<br />char yes;<br />char no;<br />char exit;<br />exit='e';<br />count=-89898;<br />yes='h';<br />no='b';<br />printf("Press 'x' to exit the counter, press any other key to start. n");<br />scanf("%c",&exit);<br />if (exit=='x')<br />{ break;}<br />do<br />{<br />++count;<br />printf("The counter is now at %d n",count);<br />}while (count < 898989);<br />printf("The final count number is %d n",count);<br />printf("Would you like to run the counter again? y for yes n for no.");<br />scanf("%c %c",&yes,&no);<br />if (yes=='y');<br />{counting();}<br />else (no=='n');<br />{main();}<br />}while (exit=='b');<br />}<br />}<br /><br /><br />int main()<br />{<br />char start;<br />char counter;<br />char addy;<br />char back;<br />char exit;<br />char yes;<br />char no;<br />int count;<br />int a;<br />int b;<br />int sum;<br />count=-897989;<br />counter='d';<br />addy='g';<br />back='f';<br />exit='k';<br />yes='n';<br />start='o';<br /><br />printf("Welcome to the Basic two in one program created by Deathscreton(a small time coder on his way to PSP homebrew.) n");<br />printf("This Basic two-in-one program contains a primative addition calculator and a high sped up counter from the numeric number -897989 to +48793. n");<br />printf("You will now be prompted to chose the Addition calculator, or the counter. n");<br />printf("For the addition calculator, press a then enter. For the counter, press c then enter. To exit the program, press x then enter. n");<br />scanf("%c %c",&addy,&counter,&exit);<br />if (addy=='a')<br />{addition();}<br />else (counter=='c');<br />{counting();}<br />else (exit=='x')<br />{break;}<br />return 0;}<br />Thats the code, now here are the current errors:
In function ‘addition’:
Line 49 :’count’ undeclared (first use in this function
(Each undeclated identifier is reported only once
for each function it appears in.)
In function ‘counting’:
Line 82: syntax error before “else”
Line 84: ‘exit’ undeclared(first use in this function)
At top level:
Line 86: syntax error before ‘}’ token
In function ‘main’:
Line 119: syntax error before “else”
Those are the errors. I don’t understand why the pop up. I fix one, and another two take that one’s place. What in the world is going on? - AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)