C++ Question Write and test a program that reads from cin one line of text, one
ID: 3794528 • Letter: C
Question
C++ Question Write and test a program that reads from cin one line of text, one character at a time using the get ( ) function, and then prints it, using the put ( ) function, with all its blanks, commas, astricts (*) and periods removed. C++ Question Write and test a program that reads from cin one line of text, one character at a time using the get ( ) function, and then prints it, using the put ( ) function, with all its blanks, commas, astricts (*) and periods removed. C++ Question Write and test a program that reads from cin one line of text, one character at a time using the get ( ) function, and then prints it, using the put ( ) function, with all its blanks, commas, astricts (*) and periods removed.Explanation / Answer
#include <iostream>
#include<cstring>
#include<string>
Using namespace std;
void main()
{
Char a[100];
cout<<"input a lineof text and print with blanks and comas";
cout<"remove astrics and periods"<<endl;
int i=0;
while(i!=100)
{
cin.get(a[i]);if(a[i]==' ')
{
break;
}
i++;
}//array will break down from here
while(a[i]!=' &&i!=100)
{
a[i]=null;
i++;
}
int j=0;
cout<<"you entered:"<<endl;
while(a[j]!='')
{
if(a[j]!=''&&a[j]!=','&&a[j]!='*'&&a[j]!='.')
{
cout.put(a[j]);
}
j++;
}
cout<<endl;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.