struct complex a,b;
int c;
printf("enter the first complex no (x+iy)\n");
scanf("%f %f \n",&a.real,&b.image);
printf("enter the 2nd complex no. (x+iy)\n");
scanf("%f %f\n",&a.real,&b.image);
while((c=getchar())!='q'){
menu();
switch(c){
case 'a':
add(a,b);
break;
case's':
sub(a,b);
break;
case'm':
mult(a,b);
break;
case'd':
div(a,b);
break;
}
}
menu()
{
printf("a=addition\n");
printf("enter an option\n");
}
add(a,b)
struct complex a,b;
{
struct complex c;
c.real=a.real+b.real;
c.image=a.image+b.image;
printf("addition of 2 complex no:\n");
output(c);
}
output(c);
struct complex c;
{
if(c.image<0)
printf("%0.2f %0.2fi\n",c.real,c.image);
else
printf("%0.2f+i%0.2f\n",c.real,c.image);
}
getch();}
not able to run the program please help!
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment