admin 管理员组文章数量: 1086019
2024年4月21日发(作者:云数据库和普通数据库)
摘自 宋鲁生 程序设计大赛
乘法口诀表
#include
#include
void main(void)
{
int i,j,x,y;
clrscr();
printf("nn * * * 乘法口诀表 * * * nn");
x=9;
y=5;
for(i=1;i<=9;i++)
{
gotoxy(x,y);
printf("%2d ",i);
x+=3;
}
x=7;
y=6;
for(i=1;i<=9;i++)
{
gotoxy(x,y);
printf("%2d ",i);
y++;
}
x=9;
y= 6;
for(i=1;i<=9;i++)
{
for(j=1;j<=9;j++)
{
gotoxy(x,y);
printf("%2d ",i*j);
y++;
}
y-=9;
x+=3;
}
printf("nn");
}
用一维数组统计学生成绩
#include
void main()
{
char SelectKey,CreditMoney,DebitMoney;
while(1)
{
do{
clrscr();
puts("=========================");
puts("| Please select key: |");
puts("| 1. Quary |");
puts("| 2. Credit |");
puts("| 3. Debit |");
puts("| 4. Return |");
puts("=========================");
SelectKey = getch();
}while( SelectKey!='1' && SelectKey!='2' && SelectKey!='3' &&
SelectKey!='4' );
switch(SelectKey)
{
case '1':
clrscr();
puts("================================");
puts("| Your balance is $1000. |");
puts("| Press any key |");
puts("================================");
getch();
break;
case '2':
do{
clrscr();
puts("==================================");
puts("| Please select Credit money: |");
puts("| 1. $50 |");
puts("| 2. $100 |");
puts("| 3. Return |");
puts("==================================");
CreditMoney = getch();
}while( CreditMoney!='1' && CreditMoney!='2' && CreditMoney!='3' );
switch(CreditMoney)
版权声明:本文标题:(完整版)C语言代码大全 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1713660909a645847.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论