I need help with this problem
Greetings,
I have this program that runs w/o any errors but I am curious why its output looks like this. My input is 1 2.2 3 4.4 5 6.6 w/o any characters. I would think it woould print 1 (space, since there is no char) then 2,2 etc... I am curious if anyone can explain to me why it does this.
Code:
#include <iostream> // cin, cout, >>, <<
#include <string> // used for char
using namespace std;
int main()
{
int i1, i2, i3;
char c1, c2, c3;
double r1, r2, r3;
cin >> noskipws
>> i1 >> c1 >> r1
>> i2 >> c2 >> r2
>> i3 >> c3 >> r3;
cout << i1 << c1 << r1
<< i2 << c2 << r2
<< i3 << c3 << r3;
return 0;
}