in c++ Ramu was given a game by his friend raj. When raj says a word then ramu needs to tell that word.Kindly help Raju and Ramu to solve the task.
Answers
Answered by
11
Program to print the string user inputs.
Language used : C++ Programming
Program : (Dynamic)
#include <iostream>
using namespace std;
int main()
{
string word;
int n;
cout<<"Enter number of words you are going to use for play : ";
cin>>n;
for(int i=0; i<n;i++)
{
cout<<"Ramu says : ";
cin>>word;
cout<<"Ravi tells "<<word<<endl;
}
return 0;
}
Input:
Enter number of words you are going to use for play : 4
Ramu says : Hi
Ramu says : Hello
Ramu says : Okay
Ramu says : Bye
Output :
Ravi tells Hi
Ravi tells Hello
Ravi tells Okay
Ravi tells Bye
Explanation :
- It is a simple, input output basic program of printing the word that we read using input function cin and print it out using cout.
- Here, before starting the game, we take the number of words they are going to consider to play this game.
- Then, we run a loop on that range and on every iteration, we ask user to input some word and print it immediately from the side of the otehr one.
Learn more :
1) About C++ programming.
https://brainly.in/question/15913674
https://brainly.in/question/610998
Similar questions
Hindi,
8 months ago
Math,
8 months ago
Math,
8 months ago
World Languages,
1 year ago
World Languages,
1 year ago