1.I need help getting started with my C++ assignment.
This is the prompt of the assignment and guidelines must follow.
...
delines must follow.
The purpose of this assignment is to give you practice using structs, using strings, writing functions and sorting. You will read a student file into an array of structs, determine grades, sort the array and print it out.
Program Steps and Requirements
Use the Student struct shown below.
Read the input file (partially shown below) and store the data in an array of structs. The input file contains 55 student records and one heading line.
Write code to determine the grade for each student. The grade determination is exactly as specified for this class in the syllabus. Remember to discard the lowest assignment grade.
Sort the array of student students in descending order by the total points.
Write the output file using the exact format shown below and include the two lines of headings in the output.
Required Student struct and named constants
const unsigned NumberOfStudents = 55;
const unsigned PointsPossible = 400;
const unsigned NumberOfAssignments = 10;
const unsigned NumberOfExercises = 10;
struct Student
{
int id;
string name;
int exercise[NumberOfExercises];
int assignment[NumberOfAssignments];
int midterm;
int final;
int codelab;
int exerciseTotal;
int assignmentTotal;
int totalPoints;
int percent;
string grade;
};
Input file
-StudId- -------Name-------- -----Exercises----- ---------Assignments--------- Mi Fin CL
12345678 Smartiepants, Sam 5 4 5 4 5 5 5 5 5 5 20 19 20 20 20 20 19 20 20 19 65 98 9
18519268 Mendoza, Victor 4 2 5 4 1 4 5 5 5 4 17 12 17 18 14 17 19 18 14 18 59 49 6
23276929 Chien, Shengfeng 2 3 0 4 4 5 2 5 5 2 9 18 15 8 19 18 18 16 19 13 64 89 8
18242679 Dhaliwal, Shawn 5 5 3 4 5 4 2 4 4 5 9 18 17 15 18 19 12 15 18 14 45 92 9
09869966 Miraftab, Mina 5 3 5 5 3 5 4 0 4 3 17 4 3 18 12 16 14 17 17 12 52 68 7
10930997 Dimas, Abraham 5 3 4 5 4 3 4 3 3 3 12 18 20 11 14 7 15 10 18 15 64 89 6
11545560 Masongsong, Mikhael 1 3 5 4 3 4 5 3 5 5 19 19 9 13 17 20 20 14 14 19 64 96 8
10626377 Zigler, Joshua 4 3 4 3 2 5 4 4 4 5 17 14 18 20 17 18 12 19 14 14 51 90 5
...
Output report file
Stud Id Name Ex Ass Mi Fin CL Tot Pct Gr
-------- ------------------- -- --- -- --- -- --- --- --
12345678 Smartiepants, Sam 48 178 65 98 9 398 100 A+
11545560 Masongsong, Mikhael 38 155 64 96 8 361 90 A-
20767544 Martins, Gustavo 40 144 67 97 10 358 90 A-
23305464 Zumwalt, Jacob 37 160 62 90 8 357 89 B+
23579439 Feirstein, Berent 42 159 55 91 9 356 89 B+
14965959 Ho, Brandon 40 157 66 84 8 355 89 B+
19988142 Wang, Lu 31 157 58 98 9 353 88 B+
09559062 Mora, Gabriel 36 137 67 100 7 347 87 B
19108176 Bailey, Tanequa 44 152 56 85 8 345 86 B
Suggested main function
int main()
{
Student students[NumberOfStudents];
getStudentDataFromFile(students, InputFilename);
determineGrades(students);
sort(students);
printStudentDataToFile(students,OutputFilename);
}
View More
2.To gain experience with the operations involving binary search trees. This data structure as linked list uses dynamic memory allocation
...
list uses dynamic memory allocation to grow as the size of the data set grows. Unlike linked lists, a binary search tree is very fast to insert, delete and search.
Project Description
When an author produce an index for his or her book, the first step in this process is to decide which words should go into the index; the second is to produce a list of the pages where each word occurs. Instead of trying to choose words out of our heads, we decided to let the computer produce a list of all the unique words used in the manuscript and their frequency of occurrence. We could then go over the list and choose which words to put into the index.
The main object in this problem is a "word" with associated frequency. The tentative definition of "word" here is a string of alphanumeric characters between markers where markers are white space and all punctuation marks; anything non-alphanumeric stops the reading. If we skip all un-allowed characters before getting the string, we should have exactly what we want. Ignoring words of fewer than three letters will remove from consideration such as "a", "is", "to", "do", and "by" that do not belong in an index.
In this project, you are asked to write a program to read any text file and then list all the "words" in alphabetic order with their frequency together appeared in the article. The "word" is defined above and has at least three letters.
Note:
Your result should be printed to an output file named YourUserID.txt.
You need to create a Binary Search Tree (BST) to store all the word object by writing an insertion or increment function. Finally, a proper traversal print function of the BST should be able to output the required results.
The BST class in the text can not be used directly to solve this problem. It is also NOT a good idea to modify the BST class to solve this problem. Instead, the following codes are recommended to start your program.
//Data stored in the node type
struct WordCount
{
string word;
int count;
};
//Node type:
struct TreeNode
{
WordCount info;
TreeNode * left;
TreeNode * right;
};
// Two function's prototype
// Increments the frequency count if the string is in the tree
// or inserts the string if it is not there.
void Insert(TreeNode*&, string);
// Prints the words in the tree and their frequency counts.
void PrintTree(TreeNode* , ofstream&);
//Start your main function and the definitions of above two functions.
Sample Run
Please type the text file name: Lincoln.txt
Please give the output text file name: mus11.txt
You are done! You can open the file "mus11.txt" to check.
Press any key to continue
------------------------------------------------------------------------------------------------------------------------------------------------
lincoln.txt---
The Gettysburg Address
Gettysburg, Pennsylvania
November 19, 1863
Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in
Liberty, and dedicated to the proposition that all men are created equal.
Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and
so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate
a portion of that field, as a final resting place for those who here gave their lives that that nation
might live. It is altogether fitting and proper that we should do this.
But, in a larger sense, we can not dedicate -- we can not consecrate -- we can not hallow -- this ground.
The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add
or detract. The world will little note, nor long remember what we say here, but it can never forget what
they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they
who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great
task remaining before us -- that from these honored dead we take increased devotion to that cause for
which they gave the last full measure of devotion -- that we here highly resolve that these dead shall not
have died in vain -- that this nation, under God, shall have a new birth of freedom -- and that government
of the people, by the people, for the people, shall not perish from the earth.
------------------------------------------------------------------------------------------------------------------------------------------------
mus11.txt
1863 1
Address 1
But 1
Four 1
Gettysburg 2
God 1
Liberty 1
November 1
Now 1
Pennsylvania 1
The 3
above 1
add 1
advanced 1
ago 1
all 1
altogether 1
and 6
any 1
are 3
battle-field 1
before 1
birth 1
brave 1
brought 1
but 1
can 5
cause 1
civil 1
come 1
conceived 2
consecrate 1
consecrated 1
continent 1
created 1
dead 3
dedicate 2
dedicated 4
detract 1
devotion 2
did 1
died 1
earth 1
endure 1
engaged 1
equal 1
far 2
fathers 1
field 1
final 1
fitting 1
for 5
forget 1
forth 1
fought 1
freedom 1
from 2
full 1
gave 2
government 1
great 3
ground 1
hallow 1
have 5
here 8
highly 1
honored 1
increased 1
larger 1
last 1
little 1
live 1
lives 1
living 2
long 2
measure 1
men 2
met 1
might 1
nation 5
never 1
new 2
nobly 1
nor 1
not 5
note 1
our 2
people 3
perish 1
place 1
poor 1
portion 1
power 1
proper 1
proposition 1
rather 2
remaining 1
remember 1
resolve 1
resting 1
say 1
score 1
sense 1
seven 1
shall 3
should 1
struggled 1
take 1
task 1
testing 1
that 13
the 9
their 1
these 2
they 3
this 4
those 1
thus 1
under 1
unfinished 1
vain 1
war 2
what 2
whether 1
which 2
who 3
will 1
work 1
world 1
years 1
View More