Need Help Writing This Program!

Assume you are trying to rank NFL teams based on the percentage of games they win in a season. The rank of a team is determined from the percentage as follows.
<50: Tier 3
>50 but <70: Tier 2 >70: Tier 1
a) Prompt user to enter the number games played and won by a team.
b) Find the percentage of winning.
c) Output to screen the percentage and rank of the team.
Can you post what you have so far?
Oh my god.
master12, You are asking your homework?
If your answer is "yes", then you will learn Programming "NEVER"

start writing codes, learn syntax of C++, use the syntax you have learned, make some mistakes, try again and again. Then you will learn.

Never scare from making mistake.
Mistakes will teach you how to program better. So mistakes are your friend!

I learned C language syntax in two days. Then I practice sooooo much.
In that practices I made more than 1,000 mistakes!
After that practices, I start some small projects. Guess how many mistakes I made?
.
.
.
almost 10. It means my mistakes decreases 100 times.
and now I am working on a big project.

Note that if a person can do something, so you can do it too.


Now if you know enough about C++ language Syntax, put your hands on keyboard and begin to write the code you want.
otherwise, read tutorials of this website for start.(http://www.cplusplus.com/doc/tutorial/).

Good luck.
This is what i have so far. It keeps failing. Can somebody help me?


#include <stdio.h>
int main()
{
int win,totalNumberOfgame;
float winningPerctange;
printf("Please enter number of game win and total number of game played by team respectively\n");
scanf("%d%d",&win,&totalNumberOfgame);
winningPerctange=(float)win/totalNumberOfgame;
printf("winningPerctange=%.3f\n", winningPerctange*100);
if(winningPerctange<50)
printf("Tier 1\n");
else if(winningPerctange>=50&&winningPerctange<70)
printf("Tier 3\n");
else if(winningPerctange>=70)
printf("Tier 2\n");
return 0;
}
/*output
:-
Please enter number of game win and total number of game played by team respectively
4
9
winningPerctange=44.444
Tier 1

*/
Your multiplying winningPerctange by 100 in the printf but your not changing it's value there.

winningPerctange is a fraction, it will always be less than 50, it will always be less than 1.

try
if(winningPerctange<.50)
Last edited on
Topic archived. No new replies allowed.