Server IP : 172.16.15.8 / Your IP : 3.15.239.0 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/amjamgochian/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// CS212 CS II Assignment 1 // Due: Mon. Feb 14, 2011 // // File Name: feb1411.cpp // Author: Abby Jamgochian // Instructor: Dr. Wang // // Compile: g++ feb1411.cpp // Run: ./a.out < stuScores.txt > out21.txt // // Goal: The program will read scores from each student and output // the avergaes to a file. // #include <iostream> using namespace std; struct StudentRec { string first, last; int score1, score2, score3; }; int main() { StudentRec stu; string n1, n2; int s1, s2, s3; cin >> n1 >> n2 >> s1 >> s2 >> s3; stu.first = n1; stu.last = n2; stu.score1 = s1; stu.score2 = s2; stu.score3 = s3; while(cin) { cout << "Student's name: " << stu.first << " " << stu.last << "\n";; cout << "Student's average: " << (stu.score1 + stu.score2 + stu.score3)/ 3.0 << "\n\n"; cin >> n1 >> n2 >> s1 >> s2 >> s3; stu.first = n1; stu.last = n2; stu.score1 = s1; stu.score2 = s2; stu.score3 = s3; } return 0; }