Server IP : 172.16.15.8 / Your IP : 13.59.198.150 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/jcwhiley/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// CS212 CS 2 Assignment 1 // Due: Monday February 14, 2011 // // File Name: cs2assign1.cpp // Author: Jennifer Whiley // Instuctor: Dr. Wang // // Compile: g++ cs2assign1.cpp // Run: ./a.out < in.txt > out.txt // Goal: The program will read a set of student test scores and output // each student's average to a file called out.txt // #include <iostream> using namespace std; struct Stutest { string fname; string lname; int test1; int test2; int test3; }; int main() { Stutest stu; string n1, n2; int t1, t2, t3; cin >> n1 >> n2 >> t1 >> t2 >> t3; // ASSIGN EACH STRUCT COMPONENT stu.fname = n1; stu.lname = n2; stu.test1 = t1; stu.test2 = t2; stu.test3 = t3; while(cin) { float avg; avg = (stu.test1 + stu.test2 + stu.test3) / 3.0; cout << stu.fname << " " << stu.lname << "'s Average: " << avg << "\n"; cin >> n1 >> n2 >> t1 >> t2 >> t3; stu.fname = n1; stu.lname = n2; stu.test1 = t1; stu.test2 = t2; stu.test3 = t3; } return 0; }