"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 / archana

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
char samp[] = "I LOVE MY COUNTRY";
char *ch;
string st;
vector<string> vec;
ch = strtok(samp, " ");
while(ch != NULL) {
printf("%s\n", ch);
vec.push_back(ch);
ch = strtok(NULL, " ");
}
while(!vec.empty()) {
cout << vec.back() << " ";
vec.pop_back();
}
}

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is #error and use of it?

681


How can I open files mentioned on the command line, and parse option flags?

596


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1860


What is static memory allocation? Explain

633


When can a far pointer be used?

589






the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

721


Calculate 1*2*3*____*n using recursive function??

1520


How can I check whether a file exists? I want to warn the user if a requested input file is missing.

657


Combinations of fibanocci prime series

1115


Which node is more powerful and can handle local information processing or graphics processing?

830


What is the benefit of using an enum rather than a #define constant?

662


When is a “switch” statement preferable over an “if” statement?

651


Why c is procedure oriented?

575


How can you be sure that a program follows the ANSI C standard?

1132


List some of the static data structures in C?

763