📄 rept.c
字号:
#include <stdio.h>
#include <stdlib.h>
void main(int argc,char *argv[])
{
int x,r;
char c;
if(argc<2) //no options typed
{
printf("This program requires two options:\n");
printf("REPT c r\n");
printf("C is the character to repeat and R is\n");
printf("the number of times to repeat it.\n");
exit(0); //quit the program right here
}
/*
They typed in both options. argv[1] contains the character
to repeat, and argv[2] is the number of times to repeat it
*/
c=argv[1][0]; //get the character
r=atoi(argv[2]); //get the repeat count
for(x=0;x<r;x++)
putchar(c); //display the character
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -