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!

Most likely you're trying to use a standard template class without including the header. Post the code.

here is my code..

#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;

}

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.

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:

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..

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).

>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:

const int lateFee = 20

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,

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

This article has been dead for over six months. Start a new discussion instead.