Question: #include #include using namespace std; char * p; void f 1 ( ) { char str [ 8 ] ; p = str; cout <

#include
#include
using namespace std;
char *p;
void f1(){
char str[8];
p = str;
cout << "Please enter a string:";
while (!cin.eof()){
cin.get(*p);
p++;
}
cout << "The string you entered is:"<< str << endl;
}
void f2()
{
cout << "Hello World!
";
}
int main()
{
cout << sizeof(char*)<< endl;
cout <<(void*) f2<< endl;
f1();
return 0;
}
Please see attached source code written in C++. Can you make the code print Hello World! by providing it with an input string? You are NOT allowed to modify the source code. Compile the code with g++. Submit your input string and the screenshot proving that the code prints Hello World!.
Hint: You may use hex editors like Notepad++ to generate the input string. Alternatively, you can write a program to generate the string.

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 Programming Questions!