//The code contains 10 distinct syntax errors. 
//Rewrite the code, correcting all syntax errors.

int _tmain(int argc, _TCHAR* argv[])
{
    int numStamps{4} = {0,0,0,0};
    ProcessFileData(numStamps);

    DisplayDenominationTable(numStamps);

    double  totalCost = CalculateCost(numStamps);
    cout << "Total cost of stamps is " << totalCost  << " euro"<< endline;

    return 0;
}

//this is my guess, so far(could not find all 10 errors) please correct me,where i am wrong:
int _tmain(int argc, _TCHAR* argv[])
{
    int numStamps;
    int numStamps[4] = (0;0;0;0);
    ProcessFileData(numStamps);

    DisplayDenominationTable(numStamps);

    double  totalCost = CalculateCost(numStamps);
    cout << "Total cost of stamps is " << totalCost  << " euro"<< endl;

    return 0;
}

Assuming the code is a snippet and not complete, there are only two direct errors (braces instead of brackets on line 6 and endline instead of endl on line 12).

If there are supposed to be 10 errors, you can't make the assumption that headers were included properly, namespace std was opened, that the functions exist, or that the functions are called correctly.

If that's all the code you were given, that should give you a hint. Otherwise, please post the full code.

a)  Attachment A contains code for a program that reads the contents of the file “Weights.txt” and counts the number of stamps of each denomination required. The program then displays the number of stamps of each denomination required and finally calculates and displays the total cost of all the stamps. The code contains 10 distinct syntax errors. Rewrite the code, correcting all syntax errors.
b)  The following is an alternate version of the program that uses functions.

int _tmain(int argc, _TCHAR* argv[])
{
    int numStamps{4} = {0,0,0,

    a)  Attachment A contains code for a program that reads the contents of the file “Weights.txt” and counts the number of stamps of each denomination required. 
    The program then displays the number of stamps of each denomination required and finally calculates and displays the total cost of all the stamps. 
    The code contains 10 distinct syntax errors. Rewrite the code, correcting all syntax errors.

    b)  The following is an alternate version of the program that uses functions.

    int _tmain(int argc, _TCHAR* argv[])
    {
        int numStamps{4} = {0,0,0,0};
        ProcessFileData(numStamps);

        DisplayDenominationTable(numStamps);

        double  totalCost = CalculateCost(numStamps);
        cout << "Total cost of stamps is " << totalCost  << " euro"<< endline;

        return 0;
    }

        //Write prototypes for each of the functions
    //Write definitions for each of the functions

Only syntax error I see is
int numStamps{4} = {0,0,0,0};

Should be
int numStamps[4] = {0,0,0,0};

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.