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;
2 ответов
+ 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.
+ 1
In future, can you include the following to allow others to better help you:
https://sololearn.com/compiler-playground/Wek0V1MyIR2r/?ref=app
https://sololearn.com/compiler-playground/W3uiji9X28C1/?ref=app