"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
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
What are compound statements?
difference between Low, Middle, High Level languages in c ?
What does it mean when a pointer is used in an if statement?
Simplify the program segment if X = B then C ← true else C ← false
How can my program discover the complete pathname to the executable from which it was invoked?
Explain can static variables be declared in a header file?
Who developed c language and when?
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer
Why is it that not all header files are declared in every C program?
What are all different types of pointers in c?
What is the use of sizeof () in c?
Does c have an equivalent to pascals with statement?