+ 2
What is the correct answer & if there's no outcome then describe why?
what is the output of this code? #include<iostream> using namespace std; int main() { string str =''2''; int l=2; cout<<str+l; }
9 Antworten
+ 4
I dont know if you put it in here right but
#include<iosteam> //Needs to be <iostream>
using namespace std;
int main() {
string str ='2' // needs ; at end and will error if you dont use "2" becasue '' is for char and you are making it a string.
int l=2;
cout<<str+l; //After other things are changed this will give you a compilation error because you cant add a string to a int.
}
+ 3
it's show compilers error....what is the correct answer and describe the right way also😊
+ 3
ha ha ha.....here some typing mistake....
but I satisfied your answers😊👍👌
+ 3
your 3rd comment clear my doubt
+ 3
ok @kurwius....means that first define then add?
+ 3
thanks @kurwius now I understand...😊
0
thanks for help @kurwius