This C++ Program demonstrates the implementation of Parallel Array.
Here is source code of the C++ Program to demonstrate the implementation of Parallel Array. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.
/*
* C++ Program to Implement Parallel Array
*/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
int i = 0, h = 0, saved = 0;
int g[ ] = {87, 99, 70, 75, 77, 91, 95};
string s [ ]= {"S1", "S2", "S3", "S4", "S5", "S6", "S7"};
for(i = 0; i < sizeof(g)/sizeof(g[0]); i++)
{
if (g[i] > h)
{
h = g[i];
saved = i;
}
}
cout << "Highest marks:" << h << " of Student: " << s[saved]<<endl;
return 0;
}
$ g++ parallel_array.cpp $ a.out Highest marks:99 of Student: S2 ------------------ (program exited with code: 1) Press return to continue
Sanfoundry Global Education & Learning Series – 1000 C++ Programs.
advertisement
advertisement
If you wish to look at all C++ Programming examples, go to C++ Programs.
If you find any mistake above, kindly email to [email protected]Related Posts:
- Check Programming Books
- Apply for C++ Internship
- Check Computer Science Books
- Check C++ Books
- Practice Computer Science MCQs