"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 a ternary operator in c?

646


Can you please compare array with pointer?

607


How can you restore a redirected standard stream?

601


What are the different types of pointers used in c language?

608


What is wrong with this declaration?

606






What is the difference between text and binary i/o?

586


Is c is a middle level language?

591


How can you convert integers to binary or hexadecimal?

606


What is the use of f in c?

551


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

712


Explain the difference between null pointer and void pointer.

657


what are the 10 different models of writing an addition program in C language?

1430


What does %d do in c?

535


What is an auto variable in c?

744


Is null valid for pointers to functions?

601