"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

Explain how do you print only part of a string?

938


How do we make a global variable accessible across files? Explain the extern keyword?

1649


Linked lists -- can you tell me how to check whether a linked list is circular?

862


how to find binary of number?

3932


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1715


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2093


What are the string functions? List some string functions available in c.

817


What are the advantage of c language?

782


What is hashing in c?

905


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2649


hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

1645


How many bytes are occupied by near, far and huge pointers (dos)?

919


using only #include and #include Write a program in C that will read an input from the user and print it back to the user if it is a palindrome. The string ends when it encounters a whitespace. The input string is at most 30 characters. Assume the string has no spaces and distinguish between and lowercase. So madam is a palindrome, but MadAm is not a palindrome. Use scanf and %s to read the string. Sample Test: Enter a string: madam madam is a palindrome. Enter a string: 09023 09023 is not a palindrome.

1604


What is structure padding and packing in c?

819


What is the process to create increment and decrement stamen in c?

809