C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 6th, 2014, 09:09 PM
brunovisk brunovisk is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2014
Posts: 1 brunovisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 27 m 27 sec
Reputation Power: 0
General - Help with this assignment please urgent

I'm stucked with part of this assignment. The assignment is consisted on three programs, the first is the base of the others two, i did the first one already but idk how to do the second and third one, i need help! thanks
this is the first program:
// The purpose of this program is to calculate the wins, ties and losses of teams, based in function and an input file to count and define how many wins, losses and ties that each team has.

#include <iostream>
#include <fstream>

using namespace std;

void OpenGamesFile (ifstream& inFile);
void InputGame (ifstream& gamesFile, int& ourSC, int& visitSC);
void CheckGame (int ourSC, int visitSC, int& wins, int& ties, int& losses); $
void OutResults (int wins, int ties, int losses);

int main()

{
ifstream inFile;
int ourSCA, visitSCA, wins, losses, ties;

wins = 0;
ties = 0;
losses = 0;

OpenGamesFile (inFile);
InputGame (inFile, ourSCA, visitSCA);

while (inFile)
{
CheckGame(ourSCA, visitSCA, wins, ties, losses);
InputGame(inFile, ourSCA, visitSCA);

}
OutResults(wins, ties, losses);
return 0;
}

void OpenGamesFile (ifstream& inFile)
{
string fileName;
cout << endl << "Enter name of Game file: ";
cin >> fileName;
inFile.open(fileName.c_str());
return;
}

void InputGame(ifstream& gamesFile, int& ourSC, int& visitSC)
{
gamesFile >> ourSC >> visitSC;
return;
}
void CheckGame(int ourSC, int visitSC, int& wins, int& ties, int& losses)
{
if (ourSC > visitSC)
wins++;
else if (ourSC == visitSC)
ties++;
else
losses++;

return;
}

void OutResults (int wins, int ties, int losses)
{

cout << endl << "Our team had " << wins << " wins," << ties << " ties, and " << losses << " losses" << endl << endl
return;
}

-------------------------------------------------------------
and this is the full asignment:
Programming Assignment: Soccer Report

This final assignment consists of three programs:

1. Our team report
2. Any single team report
3. Multiple team report

The our-team report is worth 10 points and is due April 25. The any-team and multiple-team
report programs are worth 10 and 5 points, respectively, and are due May 2. The three programs
are to be named our.cpp, single.cpp, and multi.cpp, respectively. Functional decompositions are
to be handed in for each program.
All programs are to be written using other functions in addition to the main function.
While there can be many solutions to the soccer problems, it is expected that there will be at least
three other functions. One of these functions will prompt for and input the games data file name.
Another function will input one game. Another function will output the final wins, ties, and
losses. Hmmm… We’ll need another function to count a win, tie, or loss. So, that makes at least
four functions, not counting main.
Some of these functions, such as prompting for and inputting the file name, can be quite
short, having only a few lines. This is fine—we need to a good grasp of using functions and
interfaces. Note that the main function should have little processing in it. Instead, it should be
calling other functions as needed.
For the any-team and multi-teams report program, you are also to demonstrate a call in a
non-main function to another function. We will talk about this in class.

Our Team Report

This program will input the scores of an unknown number of soccer games from a file. Each line
in the file contains the scores for a single game, in the order our score, visitor score. For
example, the file

3 2
0 1
5 3
3 3

consists of four games. In this example, our team has two wins (3-2, 5-3), one tie (3-3), and one
loss (0-1),
The program is to output the number of wins, ties, and losses our team had. Using the
above file, the sample run will look like (user input is underlined):

Enter name of games file: our-games
Our team had 2 wins, 1 tie, and 1 loss



Any Single Team Report

The any single team report program upgrades the our team report. In this program, the games file
looks like:

Mercyhurst 3 Indiana 3
Indiana 1 Edinboro 2
West_Chester 5 Gannon 3
Edinboro 2 Mercyhurst 1
Edinboro 4 Shippensburg 5
California 1 Gannon 5

Each game is a team name followed by its score followed by the other team and its score.
The program is to prompt the user for a team name and then output its record. Using the
above data file, here’s a sample run:

Enter name of games file: games
Enter name of team: Mercyhurst
Mercyhurst had 0 wins, 1 tie, and 1 loss

Multiple Team Report

The final program is simply to allow the user to enter multiple teams to find their records. Here’s
a sample run:

Enter name of games file: last-week-games

Enter name of team: Mercyhurst
Mercyhurst had 0 wins, 1 tie, and 1 loss

Enter name of team: California
California had 0 wins, 0 ties, and 1 loss

Enter name of team: Edinboro
Edinboro had 2 wins, 0 ties, and 1 loss

Enter name of team: Control-D
----------------------------
help on the last two one plis
thanks

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > General - Help with this assignment please urgent


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap