r/programminghelp • u/Lordwormthesecond • Mar 31 '25
C++ Whats wrong with this cant figure it out
I'm currently trying to learn C++ and I can't figure out whats wrong with this code. Maybe I'm just dumb, but please help. The website wants me to print the letters in that shape like down in the code
#include <iostream>
'int main() {
std::cout "
SSS L
S S L
S L
SSS L
S L
S S L
SSS LLLLL
"
}
2
Upvotes
4
u/edover Mar 31 '25
int main()which shouldn't be there, hopefully that's a reddit formatting problem when you pasted your code in.\nlikestd::cout << "first line\nsecond line\nthird line";;, see my example in point number 2.-1
u/HomeyKrogerSage Apr 01 '25
You may want to start with a language that is a little less technical. I'd recommend either web dev or game dev. Personally I learned with c# in unity making terrible games.
-1
u/RedDoughnut9 Apr 01 '25 edited Apr 01 '25
std::coutrequires<<socout<<"string";'\n', you cant format it directly like thatsome recommendations that i found about over the years of competitive programming:
#include <bits/stdc++.h>it includes every lib (compilation will be longer but runtime no)using namespace std;because I'm never doing anything outside std, a lot of people say this is a bad practice, but use it if you want i guess (if using that you don't needstd::cout, but justcoutinstead!)Pls don't hate me for using
using namespace std;🙏