Click here to Skip to main content
15,886,083 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
#include <stdio.h>
#define PF printf
int main()
t
int A(5)121, k, j;
for (k < 0; k <- 4; kı)
for (Jj 2 05 j5 < 25 j144)
Alkllil >k *j;
for (k < 4; k >- 0; k -- 2)
PF("Xd Xd", AfkI(81, AfkI(1));
for (k < 4; k > 0; k -- 2)
PF("X2d Xd", Ajk - 11/9), Afk - 11(1));
return O;


What I have tried:

#include
#define PF printf
int main()
t
int A(5)121, k, j;
for (k k *j;
for (k - 0; k -- 2)
PF(“Xd Xd“, AfkI(81, AfkI(1));
for (k 0; k -- 2)
PF(“X2d Xd", Ajk - 11/9), Afk - 11(1));
return O;
İ
Posted
Updated 16-Feb-21 22:33pm
v2
Comments
Rick York 17-Feb-21 4:02am    
printf is no much for you to manage? All righty then.

Quote:
What is the output of the following code?

Probably an error message because the code remotely look like C, but is not C.
Even if it compile, the code have no tail, no head.
 
Share this answer
 
Error messages, and that's all - that code will not compile as C code, and if it did, it wouldn't run.

"Blocks" of code statements need curly brackets roundthem: so a main fucntion would need to have them to hold any useful code:
C++
int main()
   {
   printf("Hello world!");
   return 0;
   }


A line containing a single character variable name that isn't declared won't work at all.
Lines of code need to be separated by semicolons, all variables must be declared before they are used.

There is no "--" operator in C: there is a "-=" is that's what you meant.

A for loop requires three parts: (initializer; check; incrementor) - you can't just skip one and "hope for the best".

"O" is not the same as "0".

Being too lazy to type "printf" is not a good reason for using a #define to make it quicker: it makes your code harder to read, harder to maintain, and less reliable.

Array's are not declared with round brackets, they need square brackets.

And so on.

Basically, that looks like someone spent most of the lesson on farcebook and tiktok while barely paying attention to the subject matter, and now needs to hand in homework - so they threw their shoes at a keyboard and hoped what they typed would compile ...
 
Share this answer
 
Comments
Richard MacCutchan 17-Feb-21 4:31am    
I like the return value of a surprised face at the end. :)
OriginalGriff 17-Feb-21 4:40am    
Probably the nicest bit of the whole app! :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900