What si the output of the following code:
int vb[8]
char dd[10]
for (int i= 0; i < 8; i++0
cin >> vb[i];
for (int i = 0; i <10; i++0
dd[i] ='A"
vb[3] = vb[3]--;
vb[2] = vb[6] + vb[4];
vb[1] = vb[3];
vb[3] = vb[5] + vb[1];
dd[2] = ''B';
dd[3]= 'C';
dd[4] = 'C'
For (int i = 0; i < 8; i++)
cout << vb[i] << dd[i] << endl;
Well, with simple header and footer added, my compiler gave:
try.cpp:11:8: warning: missing terminating ' character
dd[i] ='A"
^
try.cpp:11:8: error: missing terminating ' character
dd[i] ='A"
^~~
try.cpp:16:9: error: empty character constant
dd[2] = ''B';
^~~
try.cpp:16:12: warning: missing terminating ' character
dd[2] = ''B';
^
try.cpp:16:12: error: missing terminating ' character
dd[2] = ''B';
^~
try.cpp: In function 'int main()':
try.cpp:7:1: error: expected initializer before 'char'
char dd[10]
^~~~
try.cpp:8:16: error: 'i' was not declared in this scope
for (int i= 0; i < 8; i++0
^
try.cpp:10:27: error: expected ')' before numeric constant
for (int i = 0; i <10; i++0
^
try.cpp:11:1: error: expected ';' before 'dd'
dd[i] ='A"
^~
try.cpp:12:16: warning: statement has no effect [-Wunused-value]
vb[3] = vb[3]--;
^
try.cpp:13:1: error: 'vb' was not declared in this scope
vb[2] = vb[6] + vb[4];
^~
try.cpp:16:1: error: 'dd' was not declared in this scope
dd[2] = ''B';
^~
try.cpp:16:9: error: unable to find character literal operator 'operator""B' with 'char' argument
dd[2] = ''B';
Even assuming fixing all the silly syntax errors, and the undefined behaviour of vb[3], we're still left with the unknown of what you type in for cin >> vb[i];