Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main(){
  6. char a, b, c;
  7. cout<<"Enter a 3 digit number:" << endl;
  8.  
  9. cin>> a >> b >> c;
  10.  
  11. while(cin != 'n'){
  12. cout<< "3 digits only" << endl;
  13. }
  14. cout<< a << " " << b << " " << c << endl;
  15.  
  16. string num;
  17. cout<<"Enter a any digit number:" << endl;
  18. cin>> num;
  19.  
  20. char* array = &num[0];
  21. int total = num.length();
  22.  
  23. for(int i = 0; i < total; i++){
  24. cout<< array[i] << " ";
  25. }
  26.  
  27. }
  28.  
  29. Enter a 3 digit number:
  30. 123
  31. 1 2 3
  32. Enter a any digit number:
  33. 191843564
  34. 1 9 1 8 4 3 5 6 4 %
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement