| | |
compiling error - help
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2005
Posts: 3
Reputation:
Solved Threads: 0
here is my code..
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <iomanip> using namespace std; const double APR = .1999; const double financeCharge = .0167; const int lateFee = 20 int main () { double amountPastDue; double amountExcessCredit; int RevCreditLine; double PercentOver; double minAmount1; cout << "Enter customer's amount Past Due = $"; cin >> amountPastDue; cout << "Enter amount in excess of revolving credit line (if none, enter 0) = $"; cin >> amountExcessCredit; cout << endl; { minAmount1 = amountPastDue + amountExcessCredit; cout << "$" << minAmount1 << endl; } cout << endl; double TotalPercOver; double minAmount2; cout << "Enter customer's revolving credit line = $"; cin >> RevCreditLine; { PercentOver = (amountExcessCredit / RevCreditLine); cout << PercentOver*100 << "%" << endl; } { TotalPercOver = APR + PercentOver; cout << TotalPercOver*100 << "%" << endl; } if (TotalPercOver > .1999) { minAmount2 = 5 + (minAmount1); cout << "$" << minAmount2 << endl; } else { minAmount2 = minAmount1; cout << "$" << minAmount2 << endl; } cout << endl; char largestAmount; double totalA; double newBalance; double totalB; int totalC; double totalMinAmount; cout << "Enter customer's new balance = "; cin >> newBalance; cout << "$" << newBalance << endl; switch (largestAmount) { case A: { totalA = (financeCharge*amountPastDue) + lateFee; cout << "$" << totalA << endl; break; } case B: { if (newBalance < 20) { totalB = newBalance; cout << "$" << totalB << endl; } break; } case C: { if (newBalance >= 20, newBalance <= 960) { totalC = 20; cout << "$" << totalC << endl; } break; } case D: { if (newBalance < 960) { totalD = ((1/48)*newBalance); cout << "$" << totalD << endl; } break; } } cout << "Of the four codes, enter one which generated the largest amount : "; cin >> largestAmount; cout << endl; { totalMinAmount = minAmount1 + minAmount2 + largestAmount; cout << "$" << totalMinAmount << endl; } return 0; }
•
•
Join Date: Apr 2005
Posts: 3
Reputation:
Solved Threads: 0
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:
if my problem is really impossible to solve, then i'll re-do everything over.. thanks for taking your time to help anyway..
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)
assign1.cpp:10: parse error before `int' assign1.cpp:18: syntax error before `<' assign1.cpp:19: syntax error before `>' assign1.cpp:20: syntax error before `<' assign1.cpp:21: syntax error before `>' assign1.cpp:22: syntax error before `<' assign1.cpp:26: syntax error before `<' assign1.cpp:28: syntax error before `<' assign1.cpp:33: syntax error before `<' assign1.cpp:34: syntax error before `>' assign1.cpp:38: syntax error before `<' assign1.cpp:42: syntax error before `<' assign1.cpp:47: syntax error before `<' assign1.cpp:52: syntax error before `<' assign1.cpp:55: syntax error before `<' assign1.cpp:64: syntax error before `<' assign1.cpp:65: syntax error before `>' assign1.cpp:66: syntax error before `<' assign1.cpp:71: syntax error before `<' assign1.cpp:77: syntax error before `<' assign1.cpp:84: syntax error before `<' assign1.cpp:91: syntax error before `<' assign1.cpp:97: syntax error before `<' assign1.cpp:98: syntax error before `>' assign1.cpp:99: syntax error before `<' 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..
>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:
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)
const int lateFee = 20
I'm here to prove you wrong.
•
•
Join Date: Mar 2004
Posts: 1,620
Reputation:
Solved Threads: 51
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,
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
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.... #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.... assign1.cpp:10: parse error before `int'
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
![]() |
Similar Threads
- compiling error (C)
- Another "cannot find symbol" compiling error (Java)
- compiling error, tried debugging but no luck (C)
- error 88:'(' expected when trying to display an array any help (Pascal and Delphi)
- compiling error wtf!?!? (C)
- Please help me out, need help (C)
Other Threads in the C++ Forum
- Previous Thread: C++ CString Class Help!
- Next Thread: Phonebook program help
| Thread Tools | Search this Thread |
api array beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count database delete desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text text-file tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






