I am asked to make the following program:
Write a program in C++:
{a}That asks user to enter a paragraph.
{b}Then search for a sentence (or phrase) in that paragraph if that exist in it or not. The sentence or phrase must be user defined.
I don't know what mistake I have made. can someone correct me with my code. And for the second part of the program I dont know what should I do
My Code is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include<iostream>
#include<stdio.h>
usingnamespace std;
int main(){
int MAX=500;
char arr[MAX];
cout<<"Enter any paragraph which can include spaces or new line.\n";
cout<<"To exit press the tab key.\n";
cin>>arr[MAX];
cout<<"You had entered: \n";
cout<<arr[MAX];
system ("pause");
return 0;
}
I have made the part (a). Any hints for the part (b)
Part (a):
1 2 3 4 5 6 7 8 9 10 11 12
#include<iostream>
#include<string>
usingnamespace std;
int main(){
string abc;
cout<<"Enter any paragraph which can include spaces or new line.\n";
getline(cin,abc);
cout<<"You had entered: \n";
cout<<abc;
system ("pause");
return 0;
}