using namespace std;
#include <omp.h>
#include <stdio.h>
int main()
{
string input[] = {"Sam Williams", "John Phoenix", "Simon Johnson", "Sarah Khosa", "Mat Jackon", "Nick Roberts", "Isaac Wayne", "Anna Mishima", "Daniel Rose", "Aaron Black", "Jack Mohamed", "Kathrine Bruckner"};
int Score[] = {60, 85, 75, 81, 38, 26, 74, 34, 64, 83, 27, 42};
string s;
string x;
int a,l;
l=sizeof(input)/sizeof(input[0]);
stack<string> Stack_1;
stack<int> ScoreStack_1;
stack<string> Stack_2;
stack<int> ScoreStack_2;
stack<string> Stack_3;
stack<int> ScoreStack_3;
for(int i=0;i<l;i++) {Stack_1.push(input[i]); ScoreStack_1.push(Score[i]);}
cout<<"\nStack-1: "<<endl;
for(int i=0;i<l;i++)
{
x = Stack_1.top();
Stack_1.pop();
a = ScoreStack_1.top();
ScoreStack_1.pop();
cout<<"\t"<<setw(20)<<x<<"\t"<<a<<endl;
}
string space_delimiter = " ";
for(int i=0;i<l;i++)
{
x = input[i];
string word = "";
for (int j=0;j<x.length() ; j++)
{
char u=x[j];
if (u == ' ') word = ""; //First Name
else word = word + u; //Sur Name
}
// cout << word << "\t"<<word[0]<<endl;
if(word[0]!='R'&&word[0]!='J'&&word[0]!='M') {Stack_2.push(input[i]); ScoreStack_2.push(Score[i]);}
}
cout<<"\nStack-3";
for(int i=0;i<l;i++)
{
int n = Score[i];
if(n>50)
{
Stack_3.push(input[i]); ScoreStack_3.push(Score[i]);
cout<<"\t"<<setw(20)<<input[i]<<"\t"<<n<<endl;
}
}
cout<<"\n\nStack-2: "<<endl;
for(int i=0;i<l;i++)
{
x = Stack_2.top();
Stack_2.pop();
a = ScoreStack_2.top();
ScoreStack_2.pop();
cout<<"\t"<<setw(20)<<x<<"\t"<<a<<endl;
}
return 0;
}
Comments
Leave a comment