|
-
August 31st, 2011, 11:39 AM
#1
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.
-
August 31st, 2011, 11:52 AM
#2
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.
-
August 31st, 2011, 12:28 PM
#3
Re: C++ Score Program HELP
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|