"I LOVE MY COUNTRY"
write a c program to get "COUNTRY MY LOVE I" as the output.
Use any other programming language. It is not mandatory to
use C.
Answer Posted / iravani
#include<iostream>
#include<vector>
using namespace std;
int main()
{
string s,s1;
int n,i,j,k;
vector<string>v,v1;
cin>>n;
getline(cin,s,'\n');
v.push_back(s);
for(i=0;i<n;i++){
getline(cin,s,'\n');
v.push_back(s);
}
for(i=0;i<v.size();i++){
for(j=0;j<v[i].size();j++){
while(v[i][j]!=' ' && j<v[i].size()){
s1+=v[i][j];
j++;
}
v1.push_back(s1);
s1.clear();
}
for(k=v1.size()-1;k>=0;k--){
cout<<v1[k]<<" ";
}
v1.clear();
cout<<endl;
}
u can give input as many string as u want..
Is This Answer Correct ? | 9 Yes | 5 No |
Post New Answer View All Answers
What is switch in c?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
How can I direct output to the printer?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
Write a C program linear.c that creates a sequence of
processes with a given length. By
sequence it is meant that each created process has exactly
one child.
Let's look at some example outputs for the program.
Here the entire process sequence consists of process 18181:
Sara@dell:~/OSSS$ ./linear 1
Creating process sequence of length 1.
18181 begins the sequence.
An example for a sequence of length three:
Sara@dell:~/OSSS$ ./linear 3
Creating process sequence of length 3.
18233 begins the sequence.
18234 is child of 18233
18235 is child of 18234
........ this is coad .... BUt i could not compleate it .....:(
#include
How do you define a string?
What is the difference between NULL and NUL?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
How does normalization of huge pointer works?
What are the 3 types of structures?
How are strings stored in c?
Write a program to reverse a linked list in c.
What is .obj file in c?
What is static and auto variables in c?
How a string is stored in c?