Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <sstream>
- #include <algorithm>
- #include <cstdlib>
- #include <cstring>
- using namespace std;
- int main()
- {
- //prototypes
- void display_results(int a[]);
- void compute_letter_count(int a[], string s);
- //get user input for string
- string usr_string;
- cout << "Enter string: ";
- cin >> usr_string;
- //delete all non letter characters?
- //get length of string
- int length_string = usr_string.length();
- cout << "the length is: " << length_string << endl;
- //sort string in alphabetical order
- sort(usr_string.begin(), usr_string.end());
- //cout << usr_string;
- //convert string to array of chars
- const char *s = usr_string.c_str();
- //create in array to convert char array to int array
- int array[length_string];
- //loop to change each index in usr_string to int in array
- for (int i = 0; i < length_string; i++)
- {
- static_cast <int> (usr_string[i]);
- array[i] = usr_string[i];
- cout << array[i];
- }
- //cout << (int) usr_string[1];
- return 0;
- }
- void display_results(int a[])
- {
- //for (int i = 0; i < 26; )
- }
- void compute_letter_count(int a[], string s)
- {
- //
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement