码迷,mamicode.com
首页 > 其他好文 > 详细

未完待续

时间:2019-10-29 11:44:33      阅读:68      评论:0      收藏:0      [点我收藏+]

标签:eof   complex   输入   main   scan   一个   bsp   while   struct   

 

#include "stdio.h"
#include "stdlib.h"
typedef struct complex{
 int real;
 int imagine;
 complex *next;
}complex,*node;
int main()
{
 int i,j=0;
 printf("若想输入一个复数请按1,退出请按0");
 scanf("%d",&i);
 
 while(i==1)
 {
  if(i==1)
  {
   int a,b;
   printf("请输入实部:/n");
   scanf("%d",&a);
   printf("请输入虚部/n");
   scanf("%d",&b);
   node q;
   q = head;
   q->real = a;
   q->imagine = b;
   node p;
   p = (complex*)malloc(sizeof(complex));
   q->next = p;
   q = p;
   p->next = NULL;
   j++;
  }
  printf("若想输入一个复数请按1,退出请按0");
  scanf("%d",&i);
 } 
 return 0; 
}
/*node add(complex a,complex b)
 {
  complex *c;
  c->real =a->real+b->real;
  c->imagine =a->imagine+b->imagine;
  return c;   
 }
node reduce(complex a,complex b)
{
  complex c;
  c->real =a->real+b->real;
  c->imagine =a->imagine+b->imagine;
  return c;
 } 
node multiply(complex a,complex b)
{
  complex c;
  c->real =a->real*b->real-a->imagine*b->imagine;
  c->imagine =a->real*b->imagine+a->real*b->imagine;
  return c;
 } 
 
 
 */

 

未完待续

标签:eof   complex   输入   main   scan   一个   bsp   while   struct   

原文地址:https://www.cnblogs.com/p201821430008/p/11757557.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!