string troubles

Started by
2 comments, last by Chocrates 16 years, 10 months ago
im having troubles getting the individual letter of an array of chars to print out include <iostream> using namespace std; int main() { char input[1001]; int ascii[1001]; cout << "---->Basic Ascii Decoder<----\n"; cin.get(); cout << "Please input the text to be decoded now\n"; cin.getline( input, 1001, '\n');//getting their text cin.ignore(); for (int i =0; i < 1000; i++)//for loop { //ascii = toascii(input);//commented out becuase i was having problems cout << input + "\n";//this is just here to test if i am getting the string correctly, which i am not } return 0; } i eventually want to get the ascii values of them but first things first
Advertisement
What do you think input + "\n" means? Why?

(Hint: what is the *type* of input? And of "\n"?)
Is there a reason you're not using std::strings?
thanks i ended up playing around with it some more and got it working
the reason im not using std::strings is because ive forgotten how, i gave up on c for a while and am having to relearn stuff

This topic is closed to new replies.

Advertisement