Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

# include \"stdafx.h\" # include<iostream> #include <string> using namespace std

ID: 3644401 • Letter: #

Question

# include "stdafx.h"
# include<iostream>
#include <string>
using namespace std;

int main()

{
string str,s1,s3,s;
cout<<"Enter string:";
getline(cin, str);
s=str;

do
{
s1 = s.substr( 0, s.find_first_of( ' ') );
for (int i= 0; i<s1.length(); i++)
if (!isdigit (s1[i]))
break;
else
s1[i]= 'x';
s = s.substr ( s.find_firs_of(' ')+1 );
s3.append (s1) ;
s3.append ( " );
}
while ( s.find_first_of (' ') < s.length() );
s3.append ( s );

cout<< "Output: "<<s3<<endl;

system ("pause");
return 0;
}

I am getting errors on this proram not sure why. I am trying to input
john 17 1234 and outut john 17 xxxx

Explanation / Answer

You have not declared a class name!! It should be there after the include statements public class Problem