Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. #include <algorithm>
  5. #include <cstdlib>
  6. #include <cstring>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. //prototypes
  13. void display_results(int a[]);
  14. void compute_letter_count(int a[], string s);
  15.  
  16. //get user input for string
  17. string usr_string;
  18. cout << "Enter string: ";
  19. cin >> usr_string;
  20.  
  21. //delete all non letter characters?
  22.  
  23. //get length of string
  24. int length_string = usr_string.length();
  25. cout << "the length is: " << length_string << endl;
  26.  
  27. //sort string in alphabetical order
  28. sort(usr_string.begin(), usr_string.end());
  29.  
  30. //cout << usr_string;
  31. //convert string to array of chars
  32. const char *s = usr_string.c_str();
  33.  
  34. //create in array to convert char array to int array
  35. int array[length_string];
  36.  
  37. //loop to change each index in usr_string to int in array
  38. for (int i = 0; i < length_string; i++)
  39. {
  40. static_cast <int> (usr_string[i]);
  41. array[i] = usr_string[i];
  42. cout << array[i];
  43. }
  44.  
  45. //cout << (int) usr_string[1];
  46. return 0;
  47. }
  48.  
  49. void display_results(int a[])
  50. {
  51. //for (int i = 0; i < 26; )
  52.  
  53. }
  54.  
  55. void compute_letter_count(int a[], string s)
  56. {
  57.  
  58. //
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement