+ 1
How to input text in cin... For example... Compiled.. Please enter no. : input... And sum
6 Antworten
0
Read up on the above post, should give you an overall understanding on that topic...
To answer your question.
#include <iostream>
using namespace std;
int a, b; //declare variables
int main()
{
cin >> a; // stores user input in a
cin >> b; // stores user input in b
cout << a + b; //prints sum of a & b
return 0;
}
+ 8
https://www.sololearn.com/learn/CPlusPlus/1607/
learn from here..
0
no i am asking that if we could add a text before aksing for an input in cin
0
ok thx
0
Add a text how? As an input to the computer or as an output to the user, you might need to expatiate but yeah definitely both can be accomplished
0
The correct answer I got is-
cout << Enter no;
cin >> a; and then futher