Hey, I Have a problem with my code. Whenever I compile & run it I get a warning message saying:
[Warning]extended initializer lists only available with -std=c++11 or -std=gnu+11 [enabled by default]
Oh and about the program itself, it's supposed to change the first letter in the persons name with Z, so for example Jenny would be Zenny.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
usingnamespace std;
int main(int argc, char** argv) {
string c;
cout << "Type in your name: ";
cin >> c;
string {0} = 'Z';
cout << "No your name is: " << c;
return 0;
}
string {0} = 'Z';
What do you think it is doing?
Answer is: nothing useful.
I suppose you are creating temporary string and assign it value "z" which is instantly destroyed.
You probably want c[0] = 'Z' here.
As for warning, turn on C++11 support. Do it anyway because not using C++11 features is not using C++ in full power.
Oh wow, thank you. I dont know how I messed up so much by putting string instead of c. My bad, stupid thread. I've literally been staring at his for ages and the second I saw your reply I was like "SH!T I'm dumb."