0% found this document useful (0 votes)
55 views1 page

Tcs NQT Imp

Uploaded by

nakkal732
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views1 page

Tcs NQT Imp

Uploaded by

nakkal732
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

/******************************************************************************

Online C++ Compiler.


Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <vector>
#include <sstream>
#include <string>
using namespace std;
#include <algorithm>

vector<string> eod(vector<int> arr){


vector <string> output;
for(int i=0;i<arr.size();i++){
if(arr[i]%2==0){
output.push_back("Even");
}
else{
output.push_back("Odd");
}
}
return output;
}

int main()
{
string input;
vector <int> result1;
getline(cin,input);
int num;
char c;
stringstream ss(input);
while(ss>>c){
if(isdigit(c)){
ss.putback(c);
ss>>num;
result1.push_back(num);
}
}
vector <string> resultent = eod(result1);
cout<<"[";
for(int k=0;k<resultent.size();k++){
cout<<"\""<<resultent[k]<<"\"";
if(k!=resultent.size()-1){
cout<<",";
}

}
cout<<"]";
return 0;
}

You might also like