Notice: Undefined offset: 6902316 in /var/www/html/qa-external/qa-external-users.php on line 744
PUZZLE (C++) - OnlineGDB Q&A
Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

PUZZLE (C++)

+9 votes
asked Jun 10, 2024 by (6,150 points)
I was bored so I figured that I would make a C++ puzzle for beginners! :)

Here is a C++ source code FULL of errors. Correct them all and lets see if you can get the program running!
https://onlinegdb.com/XNuCfun5J

Goodluck!

2 Answers

+1 vote
answered Jun 10, 2024 by Lufiko me (170 points)
is this the correct code?

https://onlinegdb.com/xa662zqVV
commented Jun 10, 2024 by (6,150 points)
Yes! Congratulations :D
commented Jun 10, 2024 by Peter Minarik (101,340 points)
Here are some fine tuning ideas:

line 8: return 0 is a function that's supposed to return a string is rather funny though. That function should have a void return value as no meaningful value is ever returned.

line 23: there's no need for a return statement at the end of a void function.
0 votes
answered Jun 15, 2024 by Albatross (140 points)
#include <iostream>

using namespace std;

void randomVoid ()

{

  string first_userAnswer;

  cout << "hello, this is a random void! (function)"<<endl;

  cout << "what is your favorite hobby?";

  cin >> first_userAnswer;

  if (first_userAnswer == "coding" || "programming")

{

  cout << "cool!" << endl;

}

  else

{

  cout << "nice" << endl;

}

}

void congratulations ()

{

  cout <<

"if you see this message, it might mean that you were able to solve this puzzle, congrats!";

  

}

int main() {

    cout << "Hello world from the main function!" << endl;

    int x = 15;

    cout << x + 213 << endl;

    congratulations();

    randomVoid();

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...