+ 2

Convert ASCII to string

how to convert ASCII to string I have tried everything but I failed

18th Mar 2017, 10:09 PM
Thabiso Mcd Mohlomi
Thabiso Mcd Mohlomi - avatar
3 Answers
+ 15
#include <iostream> using namespace std; int main() { string str; for (int i = 0; i < 256; i++) { str += static_cast<char>(i); } cout << str; return 0; } // now you have an entire ASCII in one string.
19th Mar 2017, 12:46 AM
Hatsy Rei
Hatsy Rei - avatar
+ 13
Take a look at the codes of the other learners here (not mine). There are some examples.
18th Mar 2017, 10:25 PM
Tashi N
Tashi N - avatar
+ 2
thanks but what I need is a code which receives input from the user as ASCII numbers and then converts that to a line if string
19th Mar 2017, 1:33 PM
Thabiso Mcd Mohlomi
Thabiso Mcd Mohlomi - avatar