here
By: jewass | Date: Nov 10 2006 22:13 | Format: C++ | Expires: never | Size: 712 B | Hits: 1438
- #include <iostream>
- #include <sstream>
- #include <string>
- using namespace std;
- int main() {
- cout<<"Enter a number between 0-127 to see it's ASCI equivelent, '-999' will terminate program:n";
- int input=0;
- char cCh;
- bool show = true;
- while (input != -999) {
- show = true;
- cin>>input;
- if ((input < 0 && input != -999) || (input > 127 && input != -999)) {
- cout<<input<<" is out of range!n";
- show = false;
- }
- cCh = static_cast<char>(input);
- if (input !=-999 && show)
- cout<<input<<"t"<<cCh<<endl;
- else if (input == -999)
- cout<<"Thanks for using this program!n";
- }
- return 0;
- }
- //test runs 0, 12, 33, 45, 48, 57, 58, 65, 90, 91, 97, 122, 123, 127, 166, 164, -5, and 251
Latest pastes
1 days ago
1 days ago
2 days ago
3 days ago
5 days ago