-1
I have to put an integer, a real, a character and a sentence containing spaces up to 100 characters. I tried to make the solution but, I can only type the numbers and it is not leaving the character and the string.
#include<iostream>
#include<iomanip>
using namespace std;
int numero;
float real;
char carac;
string frase;
int main(){
cin>>numero;
cin>>real;
cin>>carac;
getline(cin,frase);
cout<<numero;
cout<<fixed;
cout.precision(6);
cout<<real<<carac<<frase<<endl;
And why are you mixing C with C++? Why don’t you do everything in C++?
– Maniero
because only with one can’t read separately. I had to do so
– Fernando Junior
Of course it does, and it’s right, creating new complications doesn’t solve the problem. Try to solve it the right way it’s easier.
– Maniero
beauty I put them all with Cin, but even when I finish gitar the acarctere a finaliza o progrma e nem le a string
– Fernando Junior