Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- using namespace std;
- void end();
- int main()
- {
- string input;
- cout << "Enter a sentence with numbers or no number it's up to you? \n"
- << "I'll find any integer number used on your sentace.\n";
- getline(cin, input);
- cout << "Your input was: \n" << input << endl;
- for (int i = 0; input.length() > i; i++)
- {
- if (input[i] == 'X')
- input[i] = '^';
- }
- for (int i = 0; input.length() > i; i++)
- {
- if (isdigit(input[i]))
- {
- if ((input[i - 1] == ' ') || (input[i - 1] == 'X'))
- {
- input[i] = 'X';
- }
- }
- }
- for (int i = 0; input.length() > i; i++)
- {
- if (input[i] == '^')
- input[i] = 'X';
- }
- cout <<"Output: \n"<< input<< endl;
- end();
- return 0;
- }
- void end()
- {
- char letter;
- cout << "Enter to a key to end the program: ";
- cin >> letter;
- }
- bitch ni
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement