CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2010
    Posts
    2

    C++ Score Program HELP

    #include<windows.h>

    #include<iostream.h>



    int main()

    {



    int start = 100;



    int zan;

    int bri;

    int ste;

    int zanlost;

    int brilost;

    int stelost;



    int total;

    int round=0;

    int winner;



    zan=start;

    bri=start;

    ste=start;



    do{



    cout<<"Please enter the number lost for each player, enter the winner as 0\n";

    cout<<"Zan=";

    cin>>zanlost;

    cout<<"Bri=";

    cin>>brilost;

    cout<<"Ste=";

    cin>>stelost;



    if(zan==0)

    {

    zan=zan+brilost+stelost;

    bri=bri-brilost;

    ste=ste-stelost;

    }



    if(bri==0)

    {

    bri=bri+zanlost+stelost;

    zan=zan-zanlost;

    ste=ste-stelost;

    }



    if(ste==0)

    {

    ste=ste+zanlost+brilost;

    zan=zan-zanlost;

    bri=bri-brilost;

    }



    round=round+1;

    cout<<"round="<<round<<"\n\n";

    cout<<"Zan="<<zan<<"\n";

    cout<<"Bri="<<bri<<"\n";

    cout<<"Ste="<<ste<<"\n";

    total=zan+bri+ste;

    cout<<"Total "<<total<<"\n";



    }while(round>-1);

    }



    Ok, the aim of the program is to work out each players score at the end or a round. I believe all my calculations are correct however the program just dosnt do any of the calculations.

    If someone could please help me with this it would be much appreciated.

    Thanks in advanced Steven.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: C++ Score Program HELP

    You're inputting into the lost variables, but checking the name variables, so they'll never be 0. Your debugger would have pointed that out to you.
    Last edited by GCDEF; August 31st, 2011 at 11:55 AM.

  3. #3
    Join Date
    Apr 2008
    Posts
    725

    Re: C++ Score Program HELP

    FAQ! code tags!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured