跳转到主内容
极星编程网:以代码为星,赴技术山海!

C程序解释goto语句

c 程序计算五个数字的平方根。变量 count 存储读取的数字的计数。当count小于或等于5时,goto read语句将控制指向读取的标签。否则,程序打印一条消息并停止。 Goto 语句 它在正常的程序执行顺序之后使用,将控制权转移到程序的其他部分。 程序 以下是使用 goto 语句的 C 程序 - web售票系统+C#语言+Sql2000数据库 系统设置:密码修改 增加用户(权限) [打印机设置 票样打印设置 这2块用不着实现系统界面上 放着就好了]基础设置:基础参数设置(买票设置/订票设置/退票设置)(比如多少时间之前不能买票订票) 车票设置(标准票/儿童票/。。。增删改) 车辆设置(增删该) 车次设置(增删该) 运营计划设置(调度设置)前台营业:销售车票 下载 现场演示
#include main(){ double x, y; int count; count = 1; printf("Enter FIVE real values in a LINE

"); read: scanf("%lf", &x); printf("

"); if (x < 0) printf("Value - %d is negative

",count); else{ y = sqrt(x); printf("%lf\t %lf

", x, y); } count = count + 1; if (count <= 5) goto read; printf("

End of computation"); }

输出 当执行上述程序时,会产生以下结果 -
Enter FIVE real values in a LINE 2.3 -4.5 2 6.8 -44.7 2.300000 1.516575 Value - 2 is negative 2.000000 1.414214 6.800000 2.607681 Value - 5 is negative End of computation

相关文章