$30.00
Description
This program reads team data to show current rankings. This introduces the use of formatted I/O in C.
Command Line Arguments:
p1 -t teamFileName
Input:
Stream input file which contains many teams. There are two different kinds of lines of data for each team:
– Team Identification Information:
o One line per team (separated by spaces)
szTeamId iWins iLosses dFeeAmount dPaidAmount
6s d d lf lf
– Team Contact Information:
o One line per team (separated by commas)
szTeamNm szEmail szPhone szContactName
12s 30s 13s 20s
o Although szTeamNm is a maximum of 12 characters, it may
contain spaces; therefore, you cannot simply use %13s.
For szFullName, you will have to use a bracket format
code using %[^,]. The next two values are also terminated by
commas.
o For szContactName, it contains spaces and is terminated by
a new line character. You will have to use a bracket format code
using %[^\n]
Files Larry provided:
cs1713p1_h.txt – include file which you must rename to cs1713p1.h
p1abc123_c.txt – program file which you must rename to p1abc123.c (using your abc123 id) and modify with your changes. It will be easier for the grader if your file names that you submit to BlackBoard include your abc123 id.
p1Team.txt – this data file is used by your program for the output that you will upload into BlackBoard
Multiple additional data files to check your error handling, but you don’t need to turn in the output for these:
p1TeamBad1.txt
p1TeamBad2.txt
Process:
While not at EOF, read a data line containing a team’s identification information. For each of those teams:
When printing the Team information, use this style (printing two lines per team):
Id Team Name Wins Loss Fee Amt Paid Amt
Contact Name Phone Email
UTSA01 Armadillos 8 0 150.00 80.00
Jean E Us (210)555-1111 utsa@xyz.com
COM001 Comm Eagles 7 1 150.00 75.00
Mae King (210)555-2222 maeking@xyz.com
SOUTH1 Slam Dunk 5 3 120.00 75.00
Jerry Tall (210)555-3333 slamdunk@gmail.com
ALHGHT Cake Eaters 4 4 175.00 100.00
E Z Street (210)555-6666 sliverspoon@xyz.com
UNKN01 Org New Blk 1 7 150.00 50.00
Bob Wire (210)555-1234 bobwire@xyz.com
NEWB01 River Rats 0 8 120.00 75.00
Rock D Boat (210)555-4444 riverrat@xyz.com
UNKN02 Hackers 3 5 150.00 75.00
Tom E Gunn (210)555-5555 cyber@gmail.com
Error Processing:
- Please include the errors you detect in stderr. For this program, the data input errors should cause your program to terminate.
Compiling:
gcc -g -o p1 p1abc123.c
Executing:
./p1 -t p1Team.txt
Executing and saving the output:
./p1 -t p1Team.txt >p1abc123Out.txt
Grading:
- Your program must be written according to my programming standards.
- Your program should use the provided include file “cs1713p1.h”.
- You must turn in your C code (p1abc123.c) and its generated output (p1abc123Out.txt) which is based on the p1Team.txt data file. Including your ABC123 id in the file names makes it easier for the grader to grade your code.
- Code which is mostly not working will receive less than 50% credit.
- If your output is manually manipulated in any manner, you will receive a zero.
- Even though your turned-in output should not have errors, error handling is required.
- Make certain your code works in Linux.
Note: Programming Assignment #2 will be a modification of this program.