What's the problem in this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the problem in this code

#include <iostream> using namespace std; void print_heart() { for (int i = 0; i < 6; i++) { for (int j = 0; j < 7; j++) { if ((i == 0 && j % 3 != 0) || (i == 1 && j % 3 == 0) || (i - j == 2) || (i + j == 8)) { cout << "* "; else { cout << " "; } } cout << endl; } int main() { print_heart(); return 0;

13th Dec 2023, 7:35 PM
abdulrahman farhat
abdulrahman farhat - avatar
2 Answers
+ 1
abdulrahman farhat the error message reveals the problem. For some reason it is missing three closing braces - }. The function is missing two of its closing braces, and main() is missing one.
13th Dec 2023, 7:47 PM
Brian
Brian - avatar
14th Dec 2023, 7:40 AM
Ausgrindtube
Ausgrindtube - avatar