/***************************************************************
* Name: Prof. Orta
* Course: Computer Science & Programming
* Class: CS04103 Section: 1 & 2
* Assignment Date: 10/18/20
* File Name: Arrays.cpp
*****************************************************************
* Purpose: Demonstrate the use of arrays
*****************************************************************/
#include <iostream>
#include <string>
#include <stdlib.h>
#include <iomanip>
using namespace std;
// Function Prototype
void dataCollection(string[],int[]);
void output(string[], int[]);
int main () {
int grades[3];
string names[3];
dataCollection(names, grades);
output(names, grades);
}
// Data Collection
void dataCollection( string names[], int grades[])
{
system("clear");
for (int x=0 ; x<3 ; x++)
{
cout << "Please enter the student name: ";
getline(cin,names[x]);
cout << "Please enter the student grade: ";
cin >> grades[x];
cin.ignore();
}
}
// Printing the Student information to the screen.
void output(string names[], int grades[])
{
system("clear");
for (int x=0 ; x<3 ; x++)
{
cout << "******************************************************************************************" << endl;
cout << left << setw(20) << "Student Name: " << names[x] << endl;
cout << left << setw(20)<< "Student grade: " << grades[x] << endl ;
cout << "******************************************************************************************" << endl << endl;
}
}