0

My c++ program using visual studio 2012 has one error that i cant figure out what. The error says " 1 IntelliSense: expected a ';' " I do believe that the eror from my program is after this part:

cout<<"\n @@@@@@@@@@@@@@@@@@@@@@";
cout<<"\n @@@@              @@@@";
cout<<"\n @@@@               @@";
cout<<"\n @@@@";
cout<<"\n @@@@";
cout<<"\n @@@@       REDITS";
cout<<"\n @@@@";
cout<<"\n @@@@";
cout<<"\n @@@@";
cout<<"\n @@@@";
cout<<"\n @@@@               @@";
cout<<"\n @@@@              @@@@";    
cout<<"\n @@@@@@@@@@@@@@@@@@@@@@";

THIS IS MY WHOLE PROGRAM

#include<iostream>
#include<conio.h>
#include<string>
#include <windows.h>

using namespace std;
int main()  

{ string un, pw, quit;
 do{    cout<<"Input Username: ";
    cin>>un;
    cout<<"Input Password: ";
    cin>>pw;
         if (un=="trisha" && pw=="josh")
            {   do 

         {system ("cls"); string l;
            cout<<"MAIN MENU ";
            cout<<"\n\nA.Basic";
            cout<<"\nB.Intermediate";
            cout<<"\nC.Advance";
            cout<<"\nD.Credits";
            cout<<"\n\nInput your Choice: ";
            cin>>l;
            if (l=="A" || l=="a")
                {
                system ("cls"); string n;
cout<<"\n @@@@@@@@@@@                                                       ";
cout<<"\n @@@@      @@@                                                       ";
cout<<"\n @@@@      @@@@                                                      ";
cout<<"\n @@@@      @@@@                                                     ";
cout<<"\n @@@@      @@@@                                                        ";
cout<<"\n @@@@@@@@@@@@                                                         ";
cout<<"\n @@@@      @@@@                                               ";
cout<<"\n @@@@        @@@                              ";
cout<<"\n @@@@        @@@@  asic                                ";
cout<<"\n @@@@        @@@@                                ";
cout<<"\n @@@@        @@@@                                     ";
cout<<"\n @@@@        @@@                         ";
cout<<"\n @@@@@@@@@@@@@@                                       ";
                cout<<"\n\n1.Addition";
                cout<<"\n2.Subtraction";
                cout<<"\n3.Multiplication";
                cout<<"\n4.Division";
                cout<<"\n\nInput your Choice: ";
                cin>>n;
                if (n=="1")
                { system ("cls");
                    int f, s, sum;
                    cout<<"Input first number: ";
                    cin>>f;
                    cout<<"Input second number: ";
                    cin>>s;
                    sum=f+s;
                    cout<<"The Sum is "<<sum;
                    cout<<"\nDo you want to quit? (press Y or N): ";
                        cin>>quit;}
                    else if (n=="2")
                    { system ("cls");
                    int f, s, dif;
                    cout<<"Input first number: ";
                    cin>>f;
                    cout<<"Input Second number; ";
                    cin>>s;
                    dif=f-s;
                    cout<<"The Difference is "<<dif;
                    cout<<"\nDo you want to quit? (press Y or N): ";
                    cin>>quit;}
                    else if (n=="3")
                    {system ("cls");
                    int f, s, prd;
                    cout<<"Input first number: ";
                    cin>>f;
                    cout<<"Inpute second number: ";
                    cin>>s;
                    prd=f*s;
                    cout<<"The Product is "<<prd;
                    cout<<"\nDo you want to quit? (press Y or N): ";
                    cin>>quit;}
                    else if (n=="4")
                    {system ("cls");
                    int f, s, q;
                    cout<<"Input first number: ";
                    cin>>f;
                    cout<<"Input second number: ";
                    cin>>s;
                    q=f/s;
                    cout<<"The Quotient is "<<q;
                    cout<<"\nDo you want to quit? (press Y or N): ";
                    cin>>quit;}
                    else
                    {system ("cls");
                    cout<<"Invalid Choice";
                    cout<<"\nDo you want to quit? (press Y or N): ";
                    cin>>quit;}}
            else if (l=="B" || l=="b")
            {system ("cls"); string n;

cout<<"\n @@@@@@@@@@@@@@@@@@@ ";
cout<<"\n @@@@@@@@@@@@@@@@@@@ ";
cout<<"\n        @@@@@ ";
cout<<"\n        @@@@@ ";
cout<<"\n        @@@@@ ";
cout<<"\n        @@@@@ ";
cout<<"\n        @@@@@   NTERMEDIATE ";
cout<<"\n        @@@@@ ";
cout<<"\n        @@@@@ ";
cout<<"\n        @@@@@ ";
cout<<"\n        @@@@@";
cout<<"\n        @@@@@";
cout<<"\n @@@@@@@@@@@@@@@@@@ ";
cout<<"\n @@@@@@@@@@@@@@@@@@ ";
            cout<<"\n\n1.swapping";
            cout<<"\n2.Highest number";
            cout<<"\n3.Students grade";
            cout<<"\n\nInput your Choice: ";
            cin>>n;
                if (n=="1")
                    {system ("cls"); string a, b, c;
                    cout<<"Input first number: ";
                    cin>>a;
                    cout<<"Input second number: ";
                    cin>>b;
                    c=a;
                    a=b;
                    b=c;
                    cout<<"The first number is: "<<a <<"The second number is: "<<b;
                    cout<<"\nDo you want to quit? (press Y or N): ";
                    cin>>quit;}
                else if (n=="2")
                {system ("cls"); int f, s;
                    cout<<"Input first number: ";
                    cin>>f;
                    cout<<"Input second number: ";
                    cin>>s;
                    if(f>s)
                        cout<<"The highest number is "<<f;
                    else
                        cout<<"The highest number is "<<s;
                    cout<<"\nDo you want to quit? (press Y or N): ";
                    cin>>quit;}
                else if(n=="3")
                {system ("cls"); float p, m, f, ave;
                cout<<"Input Prelim grade: ";
                cin>>p;
                cout<<"Input Midterm grade: ";
                cin>>m;
                cout<<"Input final grade: ";
                cin>>f;
                ave=(p+m+f)/3;
                cout<<"The average is "<<ave;
                cout<<"\nDo you want to quit? (press Y or N): ";
                cin>>quit;}
                else
                {system ("cls");
                    cout<<"Invalid Choice: ";
                    cout<<"\nDo you want to quit? (press Y or N): ";
                    cin>>quit;}}

            else if (l=="C" || l=="c")
            {system ("cls");
            string n;
cout<<"\n  @@@@@@@@@@@@@@@ ";
cout<<"\n @@@@@@@@@@@@@@@@@ ";
cout<<"\n @@             @@ ";          
cout<<"\n @@             @@ ";
cout<<"\n @@             @@ ";
cout<<"\n @@             @@ ";
cout<<"\n @@@@@@@@@@@@@@@@@ DVANCE ";
cout<<"\n @@@@@@@@@@@@@@@@@ ";
cout<<"\n @@             @@ ";
cout<<"\n @@             @@ ";
cout<<"\n @@             @@ ";
cout<<"\n @@             @@ ";
cout<<"\n @@             @@ ";
            cout<<"\n\n1.Display numbers";
            cout<<"\n\nInput your Choice: ";
            cin>>n;
                if(n=="1")
                {system ("cls"); int s,e;
                cout<<"Starting number: ";
                cin>>s;
                cout<<"Ending number: ";
                cin>>e;
                    do
                    {
                        cout<<s <<"\n";
                    s=s+1;
                    }
                    while (s<=e);
                    cout<<"\nDo you want to quit? (press Y or N): ";
                cin>>quit;}
                else
                {system ("cls"); cout<<"invalid Choice: ";
                cout<<"\nDo you want to quit? (press Y or N): ";
                cin>>quit;}}

            else if(l=="d" || l=="D")
            {system ("cls");
             system ("color 53");
cout<<"\n @@@@@@@@@@@@@@@@@@@@@@";
cout<<"\n @@@@              @@@@";
cout<<"\n @@@@               @@";
cout<<"\n @@@@";
cout<<"\n @@@@";
cout<<"\n @@@@       REDITS";
cout<<"\n @@@@";
cout<<"\n @@@@";
cout<<"\n @@@@";
cout<<"\n @@@@";
cout<<"\n @@@@               @@";
cout<<"\n @@@@              @@@@";    
cout<<"\n @@@@@@@@@@@@@@@@@@@@@@";



using namespace std;

void WaitKey();

int main()
{

    int len = 0,x, y=240; // 240 = white background, black foreground 

    string text = "Hello World. I feel pretty today!";
    len = text.length();
    cout << endl << endl << endl << "\t\t"; // start 3 down, 2 tabs, right
    for ( x=0;x<len;x++)
    {
        SetConsoleTextAttribute(console, y); // set color for the next print
        cout << text[x];
        y++; // add 1 to y, for a new color
        if ( y >254) // There are 255 colors. 255 being white on white. Nothing to see. Bypass it
            y=240; // if y > 254, start colors back at white background, black chars
        Sleep(250); // Pause between letters 
    }

    SetConsoleTextAttribute(console, 15); // set color to black background, white chars
    WaitKey(); // Program over, wait for a keypress to close program
}


void WaitKey()
{
    cout  << endl << endl << endl << "\t\t\tPress any key";
    while (_kbhit()) _getch(); // Empty the input buffer
    _getch(); // Wait for a key
    while (_kbhit()) _getch(); // Empty the input buffer (some keys sends two messages)
}

            cout<<"\nDo you want to quit now? (press Y or N): ";
            cin>>quit;}
            else
        {system ("cls"); cout<<"invalid letter";
            cout<<"\nDo you want to quit? (press Y or N): ";
            cin>>quit;}}

            while(quit=="n" || quit=="N");
                }else
            {
                cout<<" Invalid user name or Password";
            cout<<"\nDo you want to quit? (press Y or N): ";
            cin>>quit;}}
while(quit=="n" || quit=="N");
cout<<endl;
_getch();
return 0;
}
3
Contributors
2
Replies
13
Views
2 Years
Discussion Span
Last Post by rubberman
0

There are a LOT of errors in this code. Look at it analytically, refactor it, and reflect upon what you are doing. I could point to at least a half-dozen serious issues, but that wouldn't help you learn from your mistakes.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.