Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 52.14.27.122
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/drsparks/212/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/drsparks/212/../stript2.cpp
//
//	Title comments here
//
//
//	The code will read a student's record ...
//

#include <iostream>

using namespace std;

struct Student
{	string name;
	int age;
	int test1, test2, final;
	float avg;
};

int main()
{
	Student z;
	getline(cin, z.name); 	// read a whole name
	char dummy;
	int size = 0;		// # of students

	while(cin)
	{
		cin >> z.age >> z.test1 >> z.test2 >> z.final;
		z.avg = (z.test1 + z.test2 + z.final)/3.0;

		// debug
		cout << "Student's info: " << z.name << "\n" << z.age 
			<< "\n" << z.test1 << "\t" << z.test2 << "\t" << z.final << "\n";
		cout << "Avg: " << z.avg << "\n";

		size ++;
		cin.get(dummy);		// consume '\n'
		getline(cin, z.name);  
	}

	cout << "There are " << size << " students.";
	cout << "\n\nDone.\n\n";
	return 0;
}


Stv3n404 - 2023