Program questions.. for STRINGS

1. Make and run a program that will accept a user input of not more than 50 characters and find set of letters that will produce the string “just do it” consecutively. The program should output the string “just do it” or “string not found” if the entered words were unable to produce the desired string.
Sample Output:
The brown fox jumps over the lazy dog

The word just do it cannot be found on the sentence you type.


2. Make and run a program that will accept not more than 30 characters and replace all the lower case letter to upper case and all the upper case letter to lower case.
Sample Output:
The brown fox jumps over the lazy dog

tHE BROWN FOX JUMPS OVER THE LAZY DOG


3. Make and run a program that will reverse the entered string without using the function strrev().
Sample Output:
Enter a word: Technology
The reverse of this word is ygolonhceT

4. Make and run a program that will accept a maximum of 40 characters and output this format to a word without a space.
Sample Output:
The brown fox jumps over the lazy dog

Thebrownfoxjumpsoverthelazydog


5. Make and run a program that will accept a maximum of 30 characters. The program should put the last letter of every word before the first letter of the word proceeding to the first word.
Sample Output:
The brown fox jumps over the lazy dog

The ebrown nfox xjumps sover rthe elazy ydog





Please, show what you have done at this point. We are willing to help you with problems you encountered, but we won't do your homework for you.

Edit: Also tell us what functions and data types you can use.
Following code is the answer to problem 3, but it relies on C++11 standart libraries:
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

int main()
{
    std::string input, output;
    std::cout << "Enter a word: ";
    std::cin >> input;
    output.assign(input.rbegin(), input.rend());
    std::cout << output << std::endl;
    return 0;
}
Last edited on
Topic archived. No new replies allowed.