Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- using namespace std;
- int main(int argc, char** argv) {
- cout << "Input string" << endl;
- //char numbers[10] = {}'1','2','3','4','5','6','7','8','9','0'}
- char str[255];
- cin.getline(str,255);
- int length = strlen(str);
- int arr[length];
- int j=0;
- char temp[1];
- for(int i=0;i<length;i++)
- {
- // if (isdigit((unsigned char)str[i]))
- // {
- if(!isalpha(str[i])&&(str[i]!=' '))
- {
- //if(!str[i]))
- //{
- temp[0] = str[i]-48;
- arr[j]=temp[0];
- j++;
- //}
- }
- //}
- }
- /*for (int i = 0; i < length; i++) {
- for (int j = 0; j < length-1; j++) {
- if (arr[j] < arr[j + 1]) {
- int temp = arr[j]; // nicaaee aiiieieoaeuio? ia?aiaiio?
- arr[j] = arr[j + 1]; // iaiyai ianoaie
- arr[j + 1] = temp; // cia?aiey yeaiaioia
- }
- }
- }*/
- for (int i = 0; i < j; i++) {
- cout << arr[i] << " "; // auaiaei yeaiaiou ianneaa
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement