need help programming please!!!

Hi. I need help programming a program i am try to write. For the program, i have to compute statistics for a sports team. I need to write the name, # of wins, losses, ties, total games, winning average, and final team score. i also have to write whether the season was finished . here is an example of what the output should look like:

team 1234
1 win 4 losses 5 ties
total number of games played is 10 the season is finished
the winning average is 0.4566 (i made this number up)
number of games tied is greater than or equal to the number of games won
number of games tied is not greater than or equal to the number of games lose
final team score is 2.


how can i start this program. i think i have to use the while loop because i have to do 9 teams. any help would be really appreciated thank you so much.
Last edited on

Include standard headers

MAIN
	decalare needed vars:
	wins, losses, ties etc...

	prompt user to input required data for your variables e.g.
	cout << "What is the teams name? ";
	cin >> teamName;
	
	add wins losses and ties together
	IF total is less than 10
		total number of games played is (total) season is finished
	ELSE total is less than 10 
		total number of games played is (total) season was not finished
	//notice that the if uses the same printed statement, give or take a couple words
	//that completely change the meaning of the sentence(IS/NOT), youll be using this 
	//type of statement with the rest of the these ifs
	
	calculate average

	check if games tied is greater than or equal to games won
		tell user if is
	else check if games tied is less than games won
		tell user if so
	
	and so on, the rest of the program follows those guidelines...
	return 0;
END


Let me know if you don't understand anything
Last edited on
thanks. but im a beginner and im a bit confused. i started declaring the integers:

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int idnumb;
int wins;
int losses;
int tied;
int totalgames;
int remaininggames;
double winningaverage;
int finalscore;

and then i wrote this:

cout<<"start of the program.";
cout<<"first football team id number";
cin>>idnumb 1234;
while(idnumb>=0) {
cout<<"enter the number of games won";
cin>>1 wins;
cout<<"enter the number of games lost";
cin<<4 losses;
cout>>"enter the number of games tied";
cin<<5 tied;
cout<< "enter the number of total games played";
cin>>totalgames= (1+4+5);
cout<< "enter the winning average"
cin>>winningaverage= (1/9);

i know its not completed and i dont think i did this part right.
Last edited on
@iky

A variable cannot have spaces in them. Remove the numbers after your cin >> and after the cin >> idnumb. Then its totalgames=wins+losses+tied;, and the average is winningaverage = wins/totalgames;

Since you're going to have fractions in your average, you should use float or double, instead of int.

This should get you on your way to completing your program.
ok so this is what i have done to it now. im kind of stuck and not sure what to do after this. for the winning average i have double because thats the only thing that will be a decimal everything else is a integer. am i doing the couts and the cins right? how am i supposed to put in the actual data?


#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int idnumb;
int wins;
int losses;
int tied;
int totalgames;
int remaininggames;
double winningaverage;
int finalscore;

cout<<"start of the program.";
cout<<"first football team id number";
cin>>idnumb1234;
while(idnumb>=0) {
cout<<"enter the number of games won";
cin>>4wins;
cout<< enter the number of games lost";
cin<<4losses;
cout>>"enter the number of games tied";
cin<<5tied;
cout<< "enter the number of total games played";
cin>>totalgames=(wins+losses+tied);
cout<< "enter the winning average";
cin>>winningaverage=(wins/totalgames);
}
cout<<'stop';
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int idnumb;
int wins;
int losses;
int tied;
int totalgames;
int remaininggames;
double winningaverage;
int finalscore;

cout<<"start of the program.";
cout<<"first football team id number";
cin>>idnumb1234; //does not match variable
while(idnumb>=0) {


cout<<"enter the number of games won";
cin>>4wins;                                                      //whats with the random constants infront of your variables? try running your program
cout<< enter the number of games lost";
cin<<4losses;
cout>>"enter the number of games tied";
cin<<5tied;
cout<< "enter the number of total games played";
cin>>totalgames=(wins+losses+tied);   //cannot do this
cout<< "enter the winning average";
cin>>winningaverage=(wins/totalgames); //cannot do this
}
cout<<'stop';
return 0;
} 
Last edited on
ok so this is what i have done so far. didnt add much but this is it:

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int idnumb, wins, losses, tied, totalgames, remaininggames, finalscore;
double winningaverage;

//the program will print out the statistics for eight football teams
cout<<"first football team's id number"<< endl;
cin>>idnumb;
while(idnumb>=0) {
cout<<"the number of games won are"<< endl;
cin>>wins;
cout<<"the number of games lost are"<< endl;
cin<<losses;
cout>>"the number of games tied are"<< endl;
cin<<tied;
cout<< "the number of total games played are"<< endl;
cin>>totalgames=(wins+losses+tied);
if (wins+losses+tied==16)
cout<<"the season is finished"<< endl;
else (wins+losses+tied<16)
cout<<"the season is not finished"<< endl;
cout<< "the winning average is"<< endl;
cin>>winningaverage=(wins/totalgames);
if (tied>=tied)
cout<<"number of games tied is greater than or equal to the number of games won"<< endl;
else (tied>losses)
cout<< "number of games tied is not greater than the number of games lost"<< endl;
}
cout<<'stop';
return 0;
}

can someone tell me how i am supposed to put in the data and where i am supposed to put it in. thanks.
Last edited on
Topic archived. No new replies allowed.