4 回答
TA贡献1804条经验 获得超2个赞
使用前将 4 个 "`" 替换为一个 TAB 符
#include <stdio.h>
#include <stdlib.h>
void main(void)
{
````int i,m=1;
````char t;
````printf("please input a number:\n");
````scanf("%d",&i);
````for(m=1;m<11;m++)
````{
````````printf("%d*%d=%d",i,m,i*m);
````````printf(" ");
````````if(m%2= =0) printf("\n");
````````
````````printf("Continue or not?(Y/N) "); t = getch();
````````while (t != 'y' && t != 'Y' && t != 'n' && t != 'N') t = getch();
````````
````````printf("%c", t);
````````if (t == 'n' || t == 'N') break;
````````printf("\n");
````}
}
TA贡献1799条经验 获得超9个赞
建议用C++编程,把scanf该为cin,就可以了:
#include<iostream.h>
void f(int i)
{int m;
cout<<"please input a number:";
cin>>i;
for(m=1;m<11;m++)
{
cout<<i<<"*"<<m<<"="<<i*m;
cout<<" ";
if(m%2==0)
cout<<"\n";
}
}
void main()
{ int n,s;char t;
f(n);
cout<<"是否继续运行Y/N:";
cin>>t;
while(t!='N'&&t=='Y')
{f(s);
cout<<"是否继续运行Y/N:";
cin>>t;
}
}
TA贡献1875条经验 获得超5个赞
main()
{
char c ;
do
{
你的代码
printf("是否继续Y/N");
scanf(%c,&c)
}while(c=="N"||c=="n");
}
TA贡献1875条经验 获得超3个赞
#include<stdio.h>
main()
{
int i,m=1;
char t,a;
printf("输入循环条件!\n");
a=getch()
while(a!='n')
{
printf("please input a number:\n");
scanf("%d",&i);
for(m=1;m<11;m++)
{
printf("%d*%d=%d",i,m,i*m);
printf(" ");
if(m%2= =0)
printf("\n");
}
}
输入N则停止
添加回答
举报