"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 ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the advantages of a macro over a function?

924


Why is c not oop?

775


What does 3 periods mean in texting?

849


In C language what is a 'dangling pointer'?

874


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

884


Can variables be declared anywhere in c?

871


pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

2127


How can you draw circles in C?

889


Difference between linking and loading?

916


writ a program to compare using strcmp VIVA and viva with its output.

1812


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

1035


List some basic data types in c?

796


in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

960


How do we print only part of a string in c?

840


What is non linear data structure in c?

805