打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
c语言

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
void gotoxy(int x, int y)//x为列坐标,y为行坐标
{
COORD pos = {x,y};
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut, pos);
}
void str_in( char ch[], int m)//指定字符串及长度输入语句
{ char c;
int i,n;
for(i=0;i<m;i++)
{ n = -1;
do{
c=getch();
if( 1 ) n = c ;
}while( n<0 );

if( c == '\n' )break;
else {
ch[i]=c;
/*putchar('\b'); */
putchar(c);
};
};ch[i]=0;
}; void main()
{
char sc[9];
gotoxy(10,5);printf("请输入一个字符串c:");str_in(sc,8);
getch();
system("cls"); //清屏
gotoxy(11,5);printf("::::%s",sc);
} /*instr(char *pc,int m)
int c;
int n = -1;
do {
c = getch();
if( c == '\n' ) {
if( n != -1 )
break;
}
if( isdigit(c) ) {
putchar('\b');
putchar(c);
n = c - '0';
}
}while( 1 );
*/

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
洛谷 P3825 [NOI2017]游戏
C语言实现贪吃蛇
c语言例题
C语言的get函数汇总
C/C 位操作详解
实现自己的printf函数
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服