#include <iostream.h>
int main()
{
int astring[25];
cout<<"What is your first name: ";
cin>>astring[25];
cout<<"Thank you. "<<astring[25];
return 0;
}
I'd like to know your opinion. So please respond.
#include <iostream.h>
int main()
{
int astring[25];
cout<<"What is your first name: ";
cin>>astring[25];
cout<<"Thank you. "<<astring[25];
return 0;
}
I'd like to know your opinion. So please respond.
1.- your reading in your array and printing out wrong.
2. you are declaring an array of integers- yet the value you are reading in is a string not an integer.
Mr. C: Author and Instructor
First, don't use header files with .h extensions. Use the equivalent headers and read about the using directive here:
http://www.cplusplus.com/doc/ansi/hfiles.html
Second, your program doesn't work because your array is of type int and your asking the user to input their name. Also, after you declare the variable, you just use it's name, not the name with the dimension.
Code:#include <iostream> using namespace std; int main() { char astring[25]; cout << "What is your first name: "; cin.getline ( astring, 25 ); cout << "Thank you. " << astring << endl; return 0; }
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
Thanks guys I guess I didn't realize I put in an integer number.
"Must of been high on something"
You did click on that link XSquared provided, right?
Yeah, I just did. Sorry about not usin "". Even though I do know HTMl.........Code:" "
"Must of been high on something"