Question: write a program recives from user sentence (by cin.getline(sentence,N) (const int N=1000) after this ask from user to enter random number the program should devide

write a program recives from user sentence (by cin.getline(sentence,N) (const int N=1000) after this ask from user to enter random number

the program should devide the sentence for parts by the random number mean

if the random number was 3 every three letters make an word and after this reverse each word

for example :

enter an sentence: hi, my name is

enter an number: 4

output:

,ih n ym ema is

(he take first (hi, ))with the space and change every letter in it mean the last put it in the first and first in last and the second in third and third in second

after this take (my n)and change it etc.....

in the last if we still have letters that is not four mean

this sentence contains 14 index and the number is 4 mean we have two index in the last we dob't change them

c++ program

we don't use string just char and array of char

using strcpy, cin.puback(),strlen ,strcmp, cin.peek(),(we can jsut use these thing not string )

#include #include #include #include #include

using std::cin; using std::cout; using std::endl;

write a program recives from user sentence (by cin.getline(sentence,N) (const int N=1000)

Hi, my name Number=3 Hi, my namae ,hiym an eam

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!