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
using std::cin; using std::cout; using std::endl;
Hi, my name Number=3 Hi, my namae ,hiym an eam
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started