Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.139.108.48
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/acyurksaitis/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/acyurksaitis/homework2.txt
Script started on Wed 06 Feb 2008 08:10:01 PM EST
[acyurksaitis@zeus acyurksaitis]$ pico homework1.cppexitpico homework1.cpp.cpp2.cpp
   UW PICO(tm) 4.2                                                                             New Buffer                                                                                                ^G Get Help                      ^O WriteOut                      ^R Read File                     ^Y Prev Pg                       ^K Cut Text                      ^C Cur Pos                       ^X Exit                          ^J Justify                       ^W Where is                      ^V Next Pg                       ^U UnCut Text                    ^T To Spell                      [ Reading file ][ Read 76 lines ]File: homework2.cpp// CS212 HW #2:  homework2.cpp//// Due:          February 13, 2008//// Author:       Amy Yurksaitis//// Instructor:   Dr. Wang//// Goal:         To write a program that allows the user to input student//               data such as; name, age, and test scores. Then the program//               will output to the screen that information plus the//               students average, the class average,//               and the average age of the class//// Compile:      g++ homework2.cpp -o homework2.out// Run:          ./homework2.out/////////////////////////////////////////////////////////////////////////////#include<iostream>#include<iomanip>using namespace std;struct Student{       string name;int test1, test2, final;int age;float avg;};int main(){Student someone;char dummy;float class_total = 0;float class_size = 0;float class_avg;float avg_age = 0;float total_age;cout << "Input the name:  ";getline (cin,  someone.name) ;using namespace std;  struct Student{       string name;        int test1, test2, final;        int age;        float avg;};int main(){        Student someone;        char dummy;        float class_total = 0;        float class_size = 0;           float class_avg;float avg_age = 0;float total_age;        cout << "Input the name:  ";getline (cin,  someone.name) ;while(cin)        {                cout << "Enter student's age: ";        cin >> someone.age ;        cout << "Three exam scores:  ";        cin >> someone.test1 >> someone.test2 >> someone.final;  class_size ++;someone.avg = (someone.test1 + someone.test2 + someone.final)/4.0 ;                class_total += someone.avg;                avg_age += someone.age;        cout << "Name:  " << someone.name << endl;        cout << "Age: " << someone.age << endl;        cout << "Test 1:  " << someone.test1 << endl;        cout <<"Test 2:  " << someone.test2 <<endl;        cout <<"Final: " << someone.final <<endl;        cout << "Student average:  " << fixed << setprecision(1) << someone.avg << endl;cin.get(dummy);        cout <<"Input the name:  ";        getline(cin, someone.name);while(cin)        {                cout << "Enter student's age: ";        cin >> someone.age ;        cout << "Three exam scores:  ";        cin >> someone.test1 >> someone.test2 >> someone.final;  class_size ++;someone.avg = (someone.test1 + someone.test2 + someone.final)/4.0 ;                class_total += someone.avg;                avg_age += someone.age;        cout << "Name:  " << someone.name << endl;        cout << "Age: " << someone.age << endl;        cout << "Test 1:  " << someone.test1 << endl;        cout <<"Test 2:  " << someone.test2 <<endl;        cout <<"Final: " << someone.final <<endl;        cout << "Student average:  " << fixed << setprecision(1) << someone.avg << endl;cin.get(dummy);        cout <<"Input the name:  ";        getline(cin, someone.name);}total_age = avg_age/ class_size;class_avg = class_total/ class_size;cout << "\nClass average:  " << class_avg << fixed << setprecision(1) << endl;cout << "Average age of the class:  " << fixed << setprecision(0) << total_age << endl;cout << "\n\nDone.\n";return 0;}[acyurksaitis@zeus acyurksaitis]$ clear
[acyurksaitis@zeus acyurksaitis]$ clearpico homework2.cpp1.cppexit./a.out 
Input the name:  Amy
Enter student's age: 32
Three exam scores:  88
88
188
Name:  Amy
Age: 32
Test 1:  88
Test 2:  88
Final: 188
Student average:  91.0
Input the name:  Natalie
Enter student's age: 11
Three exam scores:  100
100
200
Name:  Natalie
Age: 11
Test 1:  100
Test 2:  100
Final: 200
Student average:  100.0
Input the name:  Chrissy
Enter student's age: 14
Three exam scores:  100
100
100
Name:  Chrissy
Age: 14
Test 1:  100
Test 2:  100
Final: 100
Student average:  75.0
Input the name:  P 
Class average:  88.7
Average age of the class:  19


Done.
[acyurksaitis@zeus acyurksaitis]$ exit

Script done on Wed 06 Feb 2008 08:16:56 PM EST

Stv3n404 - 2023