English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i'm havin an exam tommorow and this is part of it.pleasee help:
What will print this programm?
#include
#define A 6
#define PR printf(''i=%d j=%d k=%d/n'', i,j,k);
#define MACRO(i,j) i+j
void main()
{
int i=1, j=5, k;
k=MACRO(j,++i*4);
PR;
k+=A*MACRO(++i+3, 2+j--);
PR;
#define MACRO(j) i*j++
i*=A;
k=MACRO((3*j,++j*2)+A);
PR;
k+=MACRO((++j,k-3*j))*A;
PR;
}

2006-10-02 05:07:10 · 4 answers · asked by nba fan 2 in Science & Mathematics Mathematics

4 answers

//i=1, j=5, k
//k = 5 + 2*4 = 13
//i=2

It will print "i=2 j=5 k=13"

//k = 13 + 6*(3+3+2+5) = 91
//i=3
//then J = 4

It will print "i=3 j=4 k=91"

... etc...kind of tired

I think the best way is to just copy the code and compile it!

2006-10-02 05:11:16 · answer #1 · answered by Mariko 4 · 0 0

This code, as written, does not compile. It complains of "invalid lvalue in increment" on lines 14 and 16 (the last two uses of MACRO).

2006-10-02 05:24:24 · answer #2 · answered by James L 5 · 0 0

I'm in the wrong section!!! lol. Came over to see what it is like over here...only to find a bunch of intelligent human beings! (smart in computers and math and what-not) Power to y'all!!! And good luck!!! That looks like a bunch of gibberish to me... I truly applaud every one on this side of the Yahoo answers... use your brain power for the benefit of the world, and not the destruction of it....peace, and don't forget to Vote in the elections!!!! (:

2006-10-02 05:42:18 · answer #3 · answered by Angel of Man 4 · 0 0

Any type of printer could print that program if it is properly connected to your computer. I just cut and pasted it into Notepad to check and it printed fine.

2006-10-02 05:21:12 · answer #4 · answered by Anonymous · 0 0

fedest.com, questions and answers