Final Round
Final Round
Final Round
Sample Input and Output : Enter the input file : inputcode.c inputcode.c : #include<stdio.h> void reverse() { printf(\nReverse Function); } #define true 1 int main() { int i=2; if(i==1) printf(\nThis is dead code); i=0;
if(i) { printf(\nThis is too a dead code); reverse(); } if(true) printf(\nThis is normal code); }
Output : #include<stdio.h> #define true 1 int main() { int i=2; i=0; if(true) printf(\nThis is normal code); }
QUESTION 2: Develop a C++ Program from the given partial code to find the sum of two complex numbers without overloading '+' operator.
Specifications : 1)Code can be added anywhere but the given code cant be removed or altered or eliminated as dead code for your convenience. 2)The expression c3=(((c1*c1)-(c2*c2))/(c2-c1)); must be used to derive c3 as sum of c1 and c2. 3)Here '+' operator must not be overloaded Program : class complex { int r,i; public complex(int real,int imag) { } } class execution { int main() { complex c1,c2,c3; c3=(((c1*c1)-(c2*c2))/(c2-c1));/* where c3=c1+c2 */ } } Sample Input and Output : INPUT : Enter the complex no 1 : 3+4i Enter the complex no 2 : 5+6i OUTPUT: Sum of Two Complex Numbers : 8+10i