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

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/tasantos/hw2.cpp.copy
//
// ...
//

#include <iostream>
#include <iomanip>

using namespace std;

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

int main()
{
	// 1. decl. obj.
	Student someone;

	// 2. in
	cout << "Input the name: ";
	getline(cin, someone.name);
	cout << "Three exams: ";
	cin >> someone.test1 >> someone.test2 >> someone.final;
	cout << "The age: ";
	cin >> someone.age;	

	// 3. compute
	someone.avg = (someone.test1 + someone.test2 + someone.final)/4.0; // xx.x%

	// 4. out
	cout << "Name: " << someone.name << endl;
	cout << "Test 1: " << someone.test1 << endl;	
	cout << "Test 2: " << someone.test2 << endl;	
	cout << "Final: " << someone.final << endl;	
	cout << "Age: " << someone.age << endl;
	cout << "Average: " << someone.avg << endl;

	cout << "\nDone.\n";
	return 0;
}

Stv3n404 - 2023