943,600 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1618
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Sep 7th, 2009
0

Declaration Syntax Error on line 155. Please help need urgent .

Expand Post »
Now im getting Declaration Syntax Error on line 155. Please help need urgent .


C++ Syntax (Toggle Plain Text)
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include<process.h>
  4. #include<dos.h>
  5. void graph();
  6. void foo(){
  7. int a,b;
  8. clrscr();
  9.  
  10. gotoxy(27,12);textcolor(12);cprintf(" ");
  11. gotoxy(40,14);textcolor(12);cprintf(" ");
  12. gotoxy(29,16);textcolor(12);cprintf(" ");
  13. for(a=1;a<=72;a++){
  14. gotoxy(5+a,2);printf("Í");
  15. gotoxy(5+a,23);printf("Í");
  16. }
  17. for(b=1;b<=20;b++){
  18. gotoxy(5,2+b);printf("º");
  19. gotoxy(78,2+b);printf("º");
  20. }
  21. for(int s=1; s<=3;s++){
  22. gotoxy(41,2+s);printf("º"); }
  23. for(int o=1;o<=72;o++){
  24. gotoxy(5+o,5);printf("Í");
  25. }
  26. gotoxy(5,2);printf("É");
  27. gotoxy(78,2);printf("»");
  28. gotoxy(5,23);printf("È");
  29. gotoxy(78,23);printf("¼");
  30. gotoxy(41,2);printf("Ë");
  31. gotoxy(5,5);printf("Ì");
  32. gotoxy(78,5);printf("¹");
  33. gotoxy(41,5);printf("Ê");
  34.  
  35.  
  36. getche();
  37.  
  38.  
  39. getche();
  40.  
  41. graph();
  42. }
  43. void graph()
  44. {
  45. clrscr();
  46. int choice;
  47. char z,m;
  48.  
  49. gotoxy (12,12);textcolor(4+BLINK); cprintf("LOADING:");
  50. for(m=1;m<=50;m++){
  51. gotoxy(19+m,12);textcolor(RED);cprintf("²");
  52. }for (z=1;z<=50;z++){
  53. gotoxy(19+z,12);textcolor(GREEN);cprintf("Û");
  54. delay(40);
  55. }clrscr();
  56. gotoxy(27,3);textcolor(12);cprintf(" ");
  57. gotoxy(40,4);textcolor(12);cprintf(" ");
  58. gotoxy(29,5);textcolor(12);cprintf(" ");
  59.  
  60. for(int g=1;g<=72;g++){
  61. gotoxy(5+g,2);printf("Í");
  62. gotoxy(5+g,23);printf("Í");
  63. }
  64. for(int v=1;v<=20;v++){
  65. gotoxy(5,2+v);printf("ߺ");
  66. gotoxy(78,2+v);printf("ºß");
  67. }
  68. for(int k=1; k<=3;k++){
  69. gotoxy(41,2+k);printf(""); }
  70. for(int p=1;p<=72;p++){
  71. gotoxy(5+p,6);printf("Í");
  72. }
  73. gotoxy(5,2);textcolor(GREEN);cprintf(" É");
  74. gotoxy(78,2);textcolor(GREEN);cprintf("» ");
  75. gotoxy(5,23);textcolor(GREEN);cprintf("ßÈ");
  76. gotoxy(78,23);textcolor(GREEN);cprintf("¼ß");
  77. gotoxy(41,2);textcolor(GREEN);cprintf("Í");
  78. gotoxy(5,6);textcolor(GREEN);cprintf("ßÌ");
  79. gotoxy(78,6);textcolor(GREEN);cprintf("¹ß");
  80. gotoxy(41,6);textcolor(GREEN);cprintf("Í");
  81. for(int l=1;l<=50;l++){
  82. gotoxy(17+l,7);textcolor(YELLOW);cprintf("ß");
  83. gotoxy(17+l,20);textcolor(YELLOW);cprintf("Ü");
  84. }
  85. for(int n=1;n<=14;n++)
  86. {
  87. gotoxy(18,6+n);textcolor(YELLOW);cprintf("Þ");
  88. gotoxy(67,6+n);textcolor(YELLOW);cprintf("Ý");
  89. }
  90. gotoxy(37,7);textcolor(9);cprintf(" M E N U ");
  91. gotoxy(30,9);textcolor(6);cprintf("[1] EVEN/ODD IDENTIFIER");
  92. gotoxy(30,11);textcolor(6);cprintf("[2] 1000x NAME MULTIPLIER");
  93. gotoxy(30,13);textcolor(6);cprintf("[3] MULTIPLICATION TABLE");
  94. gotoxy(30,15);textcolor(6);cprintf("[4] TRIANGLE AREA CALCULATOR");
  95. gotoxy(30,17);textcolor(6);cprintf("[5] P A Y R O L L");
  96. gotoxy(29,19);textcolor(6);cprintf(" [6] E X I T ");
  97. gotoxy(24,22);textcolor(4);cprintf("ENTER CHOICE:");
  98. scanf("%d",&choice);
  99. switch(choice)
  100. {
  101. case 1:int dog;
  102. clrscr();
  103. printf("Enter number:");
  104. scanf("%d",&dog);
  105. if(dog%2==0)
  106. {
  107. printf("EVEN \n");
  108. }
  109. else
  110. {
  111. printf("ODD \n");
  112. } getche();graph();
  113. break;
  114. case 2:
  115. clrscr();
  116. int e,r,t;
  117. char name[15];
  118. printf("Enter your name:");
  119. scanf("%s",&name);
  120. gotoxy (12,12);textcolor(GREEN+BLINK); cprintf("LOADING:");
  121. for(t=1;t<=50;t++){
  122. gotoxy(19+t,12);textcolor(RED);cprintf("²");
  123. }for (r=1;r<=50;r++){
  124. gotoxy(19+z,12);textcolor(BLUE);cprintf("Û");
  125. delay(40);
  126. }clrscr();
  127. for(e=1; e<=1000; e++){
  128. printf("%s \t",name);
  129. }
  130. getche();graph();
  131. break;
  132. case 3: clrscr();
  133. for(int a1=1;a1<=9;a1++)
  134. {
  135. for(int a2=1;a2<=9;a2++)
  136. {
  137. printf("\t");
  138. printf("%d",a1*a2);
  139. }
  140. printf("\n");
  141. }
  142. getche();graph();
  143. break;
  144. case 4: int a,b;
  145. clrscr();
  146. printf("Enter base and height:");
  147. scanf("%d%d",&a,&b);
  148. printf("Area is %d.",(a*b)/2); getche();graph();
  149. break;
  150. case 5:
  151.  
  152. float rate,day,gp,netpay,totald,sss,med,love;int age;
  153. float basic,cola,tax;char employee[20],addr[30],sex[10],bday[8];
  154.  
  155. int main(){
  156. clrscr();
  157.  
  158. char choice;
  159. gotoxy(20,2);textcolor(4);cprintf("Payroll System");
  160. gotoxy(20,4);textcolor(5);cprintf("Select Choices:");
  161. gotoxy(18,6);textcolor(7);cprintf("[1] Add Customer Info");
  162. gotoxy(18,7);textcolor(7);cprintf("[2] Compute Payroll");
  163. gotoxy(18,8);textcolor(7);cprintf("[3] Display Information");
  164. gotoxy(18,9);textcolor(7);cprintf("[4] Exit");
  165. gotoxy(18,10);textcolor(7);cprintf("Enter Choice:");
  166. scanf("%d",&choice);
  167. switch (choice){
  168. case 1:printf("Employee Information\n\n");
  169. printf("Enter Employee name:");
  170. scanf("%s",&employee);
  171. printf("Enter address:");
  172. scanf("%s",&addr);
  173. printf("Enter sex:");
  174. scanf("%s",&sex);
  175. printf("Enter age:");
  176. scanf("%d",&age);
  177. printf("Enter bday:");
  178. scanf("%s",&bday);main();
  179.  
  180. case 2:printf("Payroll Input\n:");
  181. printf("Enter rate:");
  182. scanf("%f",&rate);
  183. printf("Enter day:");
  184. scanf("%f",&day);
  185. basic=rate*day;
  186. cola=basic*.02;
  187. gp=basic+cola;
  188. sss=gp*.073;
  189. med=gp*.081;
  190. love=gp*.092;
  191.  
  192. if(gp>=2500){
  193. tax=gp*.12;}else
  194. {
  195. printf("No tax");}
  196.  
  197. totald=sss+med+love+tax;
  198. netpay=gp-totald;main();
  199.  
  200. case 3:printf("Employee Information\n");
  201. printf("Employee name is %s\n",employee);
  202. printf("Employee address %s\n",addr);
  203. printf("Employee gender%c\n",sex);
  204. printf("Employee age %d\n",age);
  205. printf("Employee bday%s\n",bday);
  206. printf("\n");
  207. printf("payroll Information\n");
  208. printf("Rate per day%.2f\n",rate);
  209. printf("Number of day%.2f\n",day);
  210. printf("Basic%.2f\n",basic);
  211. printf("Cola %.2f\n",cola);
  212. printf("Grosspay%.2f\n",gp);
  213.  
  214. printf("Tax is%.2f\n",tax);
  215. printf("Total deduction %.2f\n",totald);
  216. printf("netpay%.2f\n",netpay);getche();main();
  217.  
  218. case 4: exit(0);
  219. default:printf("Invalid input");getche();main();
  220. }
  221. getche();graph();
  222. break;
  223. }
  224. case 6: exit(0);break;
  225. default:printf("Invalid Entry");
  226. }
  227. getche();}
Similar Threads
Reputation Points: -3
Solved Threads: 0
Newbie Poster
networkmancer is offline Offline
16 posts
since Jul 2008
Sep 7th, 2009
3

Re: Declaration Syntax Error on line 155. Please help need urgent .

I suspect that if you fixed that piss poor formatting, you would easily find the problem. But noooo, you had to make it harder on yourself by writing code in a manner that hides bugs.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Sep 7th, 2009
0

Re: Declaration Syntax Error on line 155. Please help need urgent .

Click to Expand / Collapse  Quote originally posted by Narue ...
I suspect that if you fixed that piss poor formatting, you would easily find the problem. But noooo, you had to make it harder on yourself by writing code in a manner that hides bugs.
And sorry but IM ******** New to C++. And its compiler btw is Turbo C++. Its ancient. Thank you. Please stick to the topic. Im new to C++ and knows nothing.
Reputation Points: -3
Solved Threads: 0
Newbie Poster
networkmancer is offline Offline
16 posts
since Jul 2008
Sep 7th, 2009
0

Re: Declaration Syntax Error on line 155. Please help need urgent .

And sorry but IM ******** New to C++. And its compiler btw is Turbo C++. Its ancient. Thank you. Please stick to the topic. Im new to C++ and knows nothing.
So you think bashing on a respectable regular is going to help you with your question? I don't think so.
Narue gave you some great advice. If you indent your code, you will probably see a mismatch in brackets or something.

And its compiler btw is Turbo C++. Its ancient. Thank you.
If you already know that TC++ is ancient, why are you still using it?
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
Sep 7th, 2009
0

Re: Declaration Syntax Error on line 155. Please help need urgent .

Im not bashing him. He started. Im just here asking not to be insulted.

Why I am using that compiler? Because it is our assignment and we cannot use advanced code that we did not yet tackle. Basic first that is what our teacher said . and again IM noob so sorry for the coding. (T T)
Last edited by networkmancer; Sep 7th, 2009 at 10:59 am.
Reputation Points: -3
Solved Threads: 0
Newbie Poster
networkmancer is offline Offline
16 posts
since Jul 2008
Sep 7th, 2009
0

Re: Declaration Syntax Error on line 155. Please help need urgent .

Im just here asking not to be insulted.
In the words of crunchie: "Eat some snickers. "

Why I am using that compiler? Because it is our assignment and we cannot use advanced code that we did not yet tackle. Basic first that is what our teacher said .
The problem is that you're learning all sorts of non-standard commands that you need to unlearn later. If your teacher makes you use Turbo, (s)he needs to be fired.
Visual Studio 2008 and Code::blocks are very good (free) alternatives for Turbo. C++ will non get 'more advanced' by using a compiler that lives up to the C++-standard. C++ is C++, that's why a standard was made.
Last edited by Nick Evan; Sep 7th, 2009 at 11:07 am.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
Sep 7th, 2009
3

Re: Declaration Syntax Error on line 155. Please help need urgent .

>Please stick to the topic.
I never went off topic. You have a brace mismatch, and the reason you have it is because your formatting is atrocious. Fix the formatting and you will see the problem.

Im new to C++ and knows nothing.
Clearly. But you know enough to write that mess, so you should know enough to format it like the books or tutorials you're following to learn C++. We don't format our code just to make it look pretty, we format it to make errors stand out. This is a lesson you need to learn, as early as possible, and I'm not afraid to beat it into you.

Im not bashing him. He started.
Your first mistake is thinking that I was bashing you. You're not important enough for me to bother. Just another noob who gets all insulted and defensive when I tell him that his code sucks. I haven't even gotten into the other problems with your code, and I probably won't if each issue is going to be a battle against your frail little ego.

Im just here asking not to be insulted.
Sorry dude, but bad code is bad code. If you're insulted by me pointing out your bad code, you have insecurity issues that need to be addressed.
Last edited by Narue; Sep 7th, 2009 at 11:11 am.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Sep 7th, 2009
-1

Re: Declaration Syntax Error on line 155. Please help need urgent .

Click to Expand / Collapse  Quote originally posted by niek_e ...
In the words of crunchie: "Eat some snickers. "



The problem is that you're learning all sorts of non-standard commands that you need to unlearn later. If your teacher makes you use Turbo, (s)he needs to be fired.
Visual Studio 2008 and Code::blocks are very good (free) alternatives for Turbo. C++ will non get 'more advanced' by using a compiler that lives up to the C++-standard. C++ is C++, that's why a standard was made.
Sorry but it is our assignment, I have no choice. , . That is our assignment.


Click to Expand / Collapse  Quote originally posted by Narue ...
>Please stick to the topic.
I never went off topic. You have a brace mismatch, and the reason you have it is because your formatting is atrocious. Fix the formatting and you will see the problem.

Im new to C++ and knows nothing.
Clearly. But you know enough to write that mess, so you should know enough to format it like the books or tutorials you're following to learn C++. We don't format our code just to make it look pretty, we format it to make errors stand out. This is a lesson you need to learn, as early as possible, and I'm not afraid to beat it into you.

Im not bashing him. He started.
Your first mistake is thinking that I was bashing you. You're not important enough for me to bother. Just another noob who gets all insulted and defensive when I tell him that his code sucks. I haven't even gotten into the other problems with your code, and I probably won't if each issue is going to be a battle against your frail little ego.

Im just here asking not to be insulted.
Sorry dude, but bad code is bad code. If you're insulted by me pointing out your bad code, you have insecurity issues that need to be addressed.
Sorry . ok . I know its a bad code but as I said we must stick to basic codes and not advanced . I did not code them btw. I am not studying to any books or tutorials and I know beauty is not perfect if it has bugs and errors. It is just our assignment . Not a big deal actually to discuss and I dont care actually if its messy what I care is that I need to run it . I dont care because I dont like what the program will do and I am not the one who made that code actually. Only Case 1 to case 4 is my code and all other is from my classmate. I just copied and paste it then attach my code to Case 1 to case 4 and that case 5 is not mine either..
Last edited by networkmancer; Sep 7th, 2009 at 11:45 am.
Reputation Points: -3
Solved Threads: 0
Newbie Poster
networkmancer is offline Offline
16 posts
since Jul 2008
Sep 7th, 2009
-1

Re: Declaration Syntax Error on line 155. Please help need urgent .

.
Last edited by networkmancer; Sep 7th, 2009 at 11:45 am.
Reputation Points: -3
Solved Threads: 0
Newbie Poster
networkmancer is offline Offline
16 posts
since Jul 2008
Sep 7th, 2009
0

Re: Declaration Syntax Error on line 155. Please help need urgent .

I dont care because I dont like what the program will do and I am not the one who made that code actually. Only Case 1 to case 4 is my code and all other is from my classmate. I just copied and paste it then attach my code to Case 1 to case 4 and that case 5 is not mine either..
Good luck with failing your class!

*plonk*
Last edited by Nick Evan; Sep 7th, 2009 at 11:58 am.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Manage Errors
Next Thread in C++ Forum Timeline: infinte loop





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC