求 循环运行这个程序
#include <stdio.h>#include <math.h>
void main ( )
{
int a,b,c,d,e,f;
double u1,u2;
printf("1.Pa\n");
printf("2.kPa\n");
printf("3.MPa\n");
printf("4.bar\n");
printf("5.Torr\n");
printf("please choose the unit:");
scanf("%d",&a);
printf("please enter the value:");
scanf("%lf",&u1);
switch (a)
{
case 1:
printf("1.kPa\n");
printf("2.MPa\n");
printf("3.bar\n");
printf("4.Torr\n");
printf("please choose the unit which you want to convert:");
scanf("%d",&b);
if (b==1)
{
u2=u1/1000;
printf("%lf Pa=%lf kPa\n",u1,u2);
}
else if (b==2)
{
u2=u1/1000000;
printf("%lf Pa=%lf MPa\n",u1,u2);
}
else if (b==3)
{
u2=u1/100000;
printf("%lf Pa=%lf bar\n",u1,u2);
}
else if (b==4)
{
u2=u1/0.00750063755419211;
printf("%lf Pa=%lf Torr\n",u1,u2);
}
else
printf("error!\n");
break;
case 2:
printf("1.Pa\n");
printf("2.MPa\n");
printf("3.bar\n");
printf("4.Torr\n");
printf("please choose the unit which you want to convert:");
scanf("%d",&c);
if (c==1)
{
u2=u1*1000;
printf("%lf kPa=%lf Pa\n",u1,u2);
}
else if (c==2)
{
u2=u1*0.001;
printf("%lf kPa=%lf Mpa\n",u1,u2);
}
else if (c==3)
{
u2=u1*0.01;
printf("%lf kPa=%lf bar\n",u1,u2);
}
else if (c==4)
{
u2=u1*7.50063755419211;
printf("%lf kPa=%lf Torr\n",u1,u2);
}
else
printf("error!\n");
break;
case 3:
printf("1.Pa\n");
printf("2.kPa\n");
printf("3.bar\n");
printf("4.Torr\n");
printf("please choose the unit which you want to convert:");
scanf("%d",&d);
if (d==1)
{
u2=u1*1000000;
printf("%lf MPa=%lf Pa\n",u1,u2);
}
else if (d==2)
{
u2=u1*1000;
printf("%lf MPa=%lf kPa\n",u1,u2);
}
else if (d==3)
{
u2=u1*10;
printf("%lf MPa=%lf bar\n",u1,u2);
}
else if (d==4)
{
u2=u1*7500.63755419211;
printf("%lf MPa=%lf Torr\n",u1,u2);
}
else
printf("error!\n");
break;
case 4:
printf("1.Pa\n");
printf("2.kPa\n");
printf("3.MPa\n");
printf("4.Torr\n");
printf("please choose the unit which you want to convert:");
scanf("%d",&e);
if (e==1)
{
u2=u1*100000;
printf("%lf bar=%lf Pa\n",u1,u2);
}
else if (e==2)
{
u2=u1*100;
printf("%lf bar=%lf kPa\n",u1,u2);
}
else if (e==3)
{
u2=u1*0.1;
printf("%lf bar=%lf MPa\n",u1,u2);
}
else if (e==4)
{
u2=u1*750.063755419211;
printf("%lf bar=%lf Torr\n",u1,u2);
}
else
printf("error!\n");
break;
case 5:
printf("1.Pa\n");
printf("2.kPa\n");
printf("3.MPa\n");
printf("4.bar\n");
printf("please choose the unit which you want to convert:");
scanf("%d",&f);
if (f==1)
{
u2=u1*133.322;
printf("%lf Torr=%lf Pa",u2);
}
else if (f==2)
{
u2=u1*0.133322;
printf("%lf Torr=%lf kPa\n",u1,u2);
}
else if (f==3)
{
u2=u1*0.000133322;
printf("%lf Torr=%lf MPa\n",u1,u2);
}
else if (f==4)
{
u2=u1*0.00133322;
printf("%lf Torr=%lf bar\n",u1,u2);
}
else
printf("error!\n");
break;
default:
printf("error!");
break;
}
system("pause");
}
哪位大侠帮帮忙 可以让这个程序循环运行 算出结果以后可以回到第一步 在这小弟先谢过了