- // Z_Y.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include"stdio.h"
- int main(int argc, char* argv[])
- {
- float r,x;
- float g,b;
- float c;
- while(1)
- {
- printf("请输入电阻r电感x:n");
- scanf("%f",&r);
- if(r==-1)
- break;
- else
- {
- printf("r=%fn",r);
- scanf("%f",&x);
- printf("x=%fn",x);
- c=r*r+x*x;
- g=(float)r/c;
- b=(float)x/c;
- printf("导纳为:n");
- printf("%f+j%fn",g,b);
- }
- printf("n输入-1结束!n");
- }
- return 0;
- }