How could I short this code?// // | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How could I short this code?// //

Best idea 💡 will take a lamp 😀 https://code.sololearn.com/cg51UgcNu6B6/?ref=app

23rd Nov 2021, 9:09 PM
Shaho
Shaho - avatar
17 Answers
+ 3
You could drop the switch and just print everything
23rd Nov 2021, 9:12 PM
Slick
Slick - avatar
+ 2
Another idea is: #define p print .... . . . P("* *"); I could short the function too.
23rd Nov 2021, 9:29 PM
Shaho
Shaho - avatar
+ 2
Since it is printing literal strings ending with newline, then puts() is more appropriate. printf("...\n"); Becomes puts("..."); A newline is added automatically.
24th Nov 2021, 4:11 AM
Brian
Brian - avatar
+ 1
I know what u said. But by loop is cool 😎 Do u have any idea? Like:I could clean the for loop and just write i in swich and add i++.
23rd Nov 2021, 9:26 PM
Shaho
Shaho - avatar
+ 1
Gotcha, and nah you already took care of that in the for loop Shaho Khademi so... do it? Yep you right....I made mistake but I could add this i++
23rd Nov 2021, 9:34 PM
Shaho
Shaho - avatar
+ 1
No you really wrong. I don't have any attend like you think. Friends suggest some reform. Guys don't like me I just want learn. I don't need like any more.
25th Nov 2021, 11:40 AM
Shaho
Shaho - avatar
0
Gotcha, and nah you already took care of that in the for loop Shaho Khademi so... do it?
23rd Nov 2021, 9:27 PM
Slick
Slick - avatar
0
Think of this: What would happen if you would... 1. Remove all the break statements. 2. Add one break after the closing brace of the switch statement.
24th Nov 2021, 6:26 AM
Brian
Brian - avatar
0
This breaks help the program run faster: For ex: when line 1 done the program will end and start from the bigening.and we don't need Check all line.
24th Nov 2021, 6:32 AM
Shaho
Shaho - avatar
0
Why you are even using loop and switch. 😑🤨🤔🧐 And this is batman more then butterfly. https://code.sololearn.com/cA5B0VunBMWJ/?ref=app
25th Nov 2021, 4:41 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
0
Cause I am learning loops
25th Nov 2021, 7:05 AM
Shaho
Shaho - avatar
0
if you are learning loops then learn. Then why you are even asking this question. Learning loops doesn't mean that you have to use it everywhere. I was not expecting that kind of answer.
25th Nov 2021, 11:22 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
0
Now the thing I'm thinking is that your question doesn't have any actual problem. You just want people to see your BUTTERFLY/BATMAN to get more likes I could be wrong
25th Nov 2021, 11:26 AM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
0
I think u can use "for loop" instead of using switch case
25th Nov 2021, 7:02 PM
Gourav Garg
Gourav Garg - avatar
0
zan Yokunai your post is off topic. If you want help with a different problem then start a new Q&A post.
25th Nov 2021, 8:05 PM
Brian
Brian - avatar
0
Huh? I delete it I accidentally put here
25th Nov 2021, 8:05 PM
Child Exterminator
Child Exterminator - avatar
0
zan Yokunai okay👍
25th Nov 2021, 8:12 PM
Brian
Brian - avatar