Help Me Understand: weird practice question
Nov 5, 2017 at 9:35pm UTC
I'm having an issue understanding what the following question wants:
Assume that the code below is executed as a part of a valid C++ program:
C-strings input is as follows: are weird in C++
Show the output of the code and the contents of the arrays a and b?
1 2 3 4 5
Valid Program:
char a[100], b[100];
cout << “We value your input:\n”;
cin >> a >> b;
cout << a << “+” << b << endl;
What is this question asking me, and how do I proceed in answering it? Thank you.
Last edited on Nov 5, 2017 at 11:17pm UTC
Nov 5, 2017 at 10:13pm UTC
I think one point it's trying to get at is how cin works - if the input is "are weird in C++", what will cin read into those character arrays? Will it read the whole phrase?
Topic archived. No new replies allowed.