VC++ 中的过程问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 09:03:33
#include<stdio.h>
void oblong()
{
float height,width;
printf("\nOblong");
printf("\n\n Height:");
scanf("%f",&height);
printf(" Width:");
scanf("%f",&width);
printf(" The Oblong's area is %.2f\n\n",height*width);
printf("Do you want to try again?\n");
printf("Yes/No:");
}
void square()
{
float lon;
printf("\nSquare");
printf("\n\n long:");
scanf("%f",&lon);
printf(" The Square's area is %.2f\n\n",lon*lon);
}
void round()
{
float r;
printf("\nRound");
printf("\n\n R:");
scanf("%f",&r);
r=r*r*3.141592;
printf(" The Round's area is %.2f\n\n",r);
}
void main1()
{

应该不是没运行,是字符缓冲导致

scanf("%c",&a); 没用停下来接受键盘输入,直接从缓冲中读取字符

你可以在这句话前加上清键盘缓冲的语句,或者将这句话换成 a=getch();试下