Hello,
I haven't posted here in a while because I have been away from
programing. Due to financial constraints, I am not able to attend
school at this time. I appreciate everyone bearing with me trying to
keep everything fresh. Anyway, I can't compile a simple program that
outputs the length of a string with this code. It doesn't compile
correctly.
//hello.cpp
#include <string>
#include <iostream>
using namespace std;
int main()
{
char mystring = string str("Hello Universe!");
cout << "The size of the string " << mystring << "is: " << str.size()
<< endl;
return 0;
}
However if I eliminate the variable "mystring" it will compile without
a problem.
My questions are:
1)How can I compile the program correctly by declaring a variable
"mystring = string str("Hello World!")"?
2)How come this program doesn't compile as I have it written?
Thanks