944,123 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1884
  • C++ RSS
Apr 11th, 2005
0

compiling error - help

Expand Post »
hi.. i'm pretty new with C++, so pls. bear with my question, simple as it may be.

can anyone pls. tell me what this error mean:
syntax error before `<'

i have a whole bunch of them when i try to compile.. if needed, i'll post up the codes.

Thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ecua_frap is offline Offline
3 posts
since Apr 2005
Apr 11th, 2005
0

Re: compiling error - help

Most likely you're trying to use a standard template class without including the header. Post the code.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Apr 11th, 2005
0

Re: compiling error - help

here is my code..

C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. const double APR = .1999;
  6. const double financeCharge = .0167;
  7. const int lateFee = 20
  8.  
  9.  
  10. int main ()
  11. {
  12. double amountPastDue;
  13. double amountExcessCredit;
  14. int RevCreditLine;
  15. double PercentOver;
  16. double minAmount1;
  17.  
  18. cout << "Enter customer's amount Past Due = $";
  19. cin >> amountPastDue;
  20. cout << "Enter amount in excess of revolving credit line (if none, enter
  21. 0) = $";
  22. cin >> amountExcessCredit;
  23. cout << endl;
  24.  
  25. {
  26. minAmount1 = amountPastDue + amountExcessCredit;
  27. cout << "$" << minAmount1 << endl;
  28. }
  29. cout << endl;
  30.  
  31. double TotalPercOver;
  32. double minAmount2;
  33.  
  34. cout << "Enter customer's revolving credit line = $";
  35. cin >> RevCreditLine;
  36.  
  37. {
  38. PercentOver = (amountExcessCredit / RevCreditLine);
  39. cout << PercentOver*100 << "%" << endl;
  40. }
  41. {
  42. TotalPercOver = APR + PercentOver;
  43. cout << TotalPercOver*100 << "%" << endl;
  44. }
  45. if (TotalPercOver > .1999)
  46. {
  47. minAmount2 = 5 + (minAmount1);
  48. cout << "$" << minAmount2 << endl;
  49. }
  50. else
  51. {
  52. minAmount2 = minAmount1;
  53. cout << "$" << minAmount2 << endl;
  54. }
  55.  
  56. cout << endl;
  57.  
  58. char largestAmount;
  59. double totalA;
  60. double newBalance;
  61. double totalB;
  62. int totalC;
  63. double totalMinAmount;
  64.  
  65. cout << "Enter customer's new balance = ";
  66. cin >> newBalance;
  67. cout << "$" << newBalance << endl;
  68.  
  69. switch (largestAmount) {
  70. case A: {
  71. totalA = (financeCharge*amountPastDue) + lateFee;
  72. cout << "$" << totalA << endl;
  73. break;
  74. }
  75. case B: {
  76. if (newBalance < 20) {
  77. totalB = newBalance;
  78. cout << "$" << totalB << endl;
  79. }
  80. break;
  81. }
  82. case C: {
  83. if (newBalance >= 20, newBalance <= 960) {
  84. totalC = 20;
  85. cout << "$" << totalC << endl;
  86. }
  87. break;
  88. }
  89. case D: {
  90. if (newBalance < 960) {
  91. totalD = ((1/48)*newBalance);
  92. cout << "$" << totalD << endl;
  93. }
  94. break;
  95. }
  96. }
  97.  
  98. cout << "Of the four codes, enter one which generated the largest amount
  99. : ";
  100. cin >> largestAmount;
  101. cout << endl;
  102.  
  103. {
  104. totalMinAmount = minAmount1 + minAmount2 + largestAmount;
  105. cout << "$" << totalMinAmount << endl;
  106. }
  107. return 0;
  108.  
  109. }
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ecua_frap is offline Offline
3 posts
since Apr 2005
Apr 11th, 2005
0

Re: compiling error - help

There's really too much wrong with that code to fix. I suggest you start over, this time compiling and testing as you go. As it is, it looks like you wrote it all before ever trying to compile.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Apr 11th, 2005
0

Re: compiling error - help

i did that for the first half and it was working fine.. however, due to time constraint, i wrote the second half without checking it. then when i tried to compile it all, it didn't work anymore. stupid mistake - now i'm faced with a problem

but as i asked initially, in general, what does the error " syntax error before `<' " mean?

if it helps, these are the errors i get:
C++ Syntax (Toggle Plain Text)
  1. assign1.cpp:10: parse error before `int'
  2. assign1.cpp:18: syntax error before `<'
  3. assign1.cpp:19: syntax error before `>'
  4. assign1.cpp:20: syntax error before `<'
  5. assign1.cpp:21: syntax error before `>'
  6. assign1.cpp:22: syntax error before `<'
  7. assign1.cpp:26: syntax error before `<'
  8. assign1.cpp:28: syntax error before `<'
  9. assign1.cpp:33: syntax error before `<'
  10. assign1.cpp:34: syntax error before `>'
  11. assign1.cpp:38: syntax error before `<'
  12. assign1.cpp:42: syntax error before `<'
  13. assign1.cpp:47: syntax error before `<'
  14. assign1.cpp:52: syntax error before `<'
  15. assign1.cpp:55: syntax error before `<'
  16. assign1.cpp:64: syntax error before `<'
  17. assign1.cpp:65: syntax error before `>'
  18. assign1.cpp:66: syntax error before `<'
  19. assign1.cpp:71: syntax error before `<'
  20. assign1.cpp:77: syntax error before `<'
  21. assign1.cpp:84: syntax error before `<'
  22. assign1.cpp:91: syntax error before `<'
  23. assign1.cpp:97: syntax error before `<'
  24. assign1.cpp:98: syntax error before `>'
  25. assign1.cpp:99: syntax error before `<'
  26. assign1.cpp:103: syntax error before `<'

if my problem is really impossible to solve, then i'll re-do everything over.. thanks for taking your time to help anyway..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ecua_frap is offline Offline
3 posts
since Apr 2005
Apr 12th, 2005
0

Re: compiling error - help

Quote originally posted by ecua_frap ...
but as i asked initially, in general, what does the error " syntax error before `<' " mean?
well, in general, it means something used before the '<' symbol was sytactically incorrect(used incorrectly).
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
marinme is offline Offline
63 posts
since Apr 2005
Apr 12th, 2005
0

Re: compiling error - help

>what does the error " syntax error before `<' " mean?
You have syntax errors all over the place, but the first error is failure to terminate this line with a semicolon:
C++ Syntax (Toggle Plain Text)
  1. const int lateFee = 20
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Apr 12th, 2005
0

Re: compiling error - help

Hi,

Just to point out, those numbers in the syntax error report are line numbers inside the files. Look a few lines up or down of the cited line number for a hint.

For example,

C++ Syntax (Toggle Plain Text)
  1. 1.... #include <iostream>
  2. 2.... #include <iomanip>
  3. 3.....using namespace std;
  4. 4.....
  5. 5.....const double APR = .1999;
  6. 6.....const double financeCharge = .0167;
  7. 7.....const int lateFee = 20
  8. 8.....
  9. 9.....
  10. 10....int main ()
  11. 11....{
  12. 12....
  13.  
  14. assign1.cpp:10: parse error before `int'
  15.  

We see that there is a problem somewhere around line 10. Looking up a few lines, we see the statement lateFee = 20 but no semicolon (

The numbers are there to help you. It has been my experience that the numbers hint to problems above the line number. Also remember that one little bug can throw the whole soup down the drain... fix from top to bottom, and you can see from time to time that a whole mess of things get corrected by fixing one little part.

This is the art of debugging.

Christian
Team Colleague
Reputation Points: 121
Solved Threads: 57
Posting Virtuoso
kc0arf is offline Offline
1,629 posts
since Mar 2004

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: C++ CString Class Help!
Next Thread in C++ Forum Timeline: Phonebook program help





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


Follow us on Twitter


© 2011 DaniWeb® LLC