I need help to find out how to read a string like
cout << "Helloworld"
and put the characters into an array so it would look like
H
e
l
l
o
w
o
r
l
d
any help would be great.
Reading a string from a file or from your program?
If you are using cout, meaning it is from your program, then you can just make the array manually because you know what the output is.
Try this
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
cout << "Enter the string : " ;
getline(cin, str);
for (size_t i=0; i<=str.size()-1; i++)
cout << str[i] << endl;
return 0;
}
A string itself is an array of characters