Tuesday, 3 February 2015

Parallel Array in C++

Structure of the Problem Requirements  

The Parallel array can store multiple fields of data for several items at a time. Series of data values store in array which can be accessed by their index number. The Parallel array size should be same. In this problem we will calculate the average score of the student in a quiz within the series of their name.

Source Code

#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
int main()
string name[2];
int Quiz_1[2];
int Quiz_2[2];
float AverageScore[2];
int i;
cout<<"\n\t\t Parallel Array \n\n\n";
cout << "Student Name : ";
cin >> name[i];
cout << "Enter Quiz_1 Marks : ";
cin >> Quiz_1[i];
cout << "Enter Quiz_1 Marks : ";
cin >> Quiz_2[i];
AverageScore[i] = (Quiz_1[i] + Quiz_2[i]) / 2;
cout << endl;
cout << " Name " << " " << " Average " << endl;
cout << name[i] << " " << AverageScore[i] << endl;

Output of the Program

Parallel Array in C++

Share it Please

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.


Post a Comment