| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 408 人关注过本帖
标题:下面程序用'*'怎么回显
只看楼主 加入收藏
sjzfmyxc
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2008-2-29
收藏
 问题点数:0 回复次数:1 
下面程序用'*'怎么回显
#include<stdio.h>
密码用‘*’回显,帮忙修改一下吧!谢谢了!
#include<string.h>
void main()
{
    int i=0,j=0,k=0,z=0,n=0;
    char name1[10],name2[6]="happy",s1[10],s2[4]="abc";
     printf("please input your name:");
     gets(name1);
     
     while(strcmp(name1,name2)!=0&&j<=1)
     {
         printf("input again:");
         gets(name1);
         
         j++;
     }
     if(strcmp(name1,name2)!=0)
         printf("over");
     
     else
     {
         printf("please input your password:");
         while((s1[i]=getchar())!='\n')
         
         {    putchar('*');
            
            
            i++;
         }
         s1[i]='\0';
         while(strcmp(s1,s2)!=0&&z<=1)
         {n=0;
             printf("input again:");
             while((s1[n]=getchar())!='\n')
             {
                putchar('*');
                 n++;
             }
             s1[n]='\0';
             z++;
         }
             if(strcmp(s1,s2)==0)
            
                 printf("pass");
               
            
             else
                 printf("fail");
         
     }
}
搜索更多相关主题的帖子: include please 密码 
2008-04-28 13:56
sjzfmyxc
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2008-2-29
收藏
得分:0 
调试出来了
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
    int i=0,j=0,k=0,z=0,n=0;
    char name1[10],name2[6]="happy",s1[10],s2[4]="abc";
     printf("please input your name:");
     gets(name1);
    
     while(strcmp(name1,name2)!=0&&j<=1)
     {
         printf("input again:");
         gets(name1);
        
         j++;
     }
     if(strcmp(name1,name2)!=0)
         printf("over");
    
     else
     {
         printf("please input your password:");
         while((s1[i]=getch())!='\r')
        
         {    putchar('*');
            
            
            i++;
         }
         s1[i]='\0';
         while(strcmp(s1,s2)!=0&&z<=1)
         {n=0;
             printf("input again:");
             while((s1[n]=getch())!='\r')
             {
                putchar('*');
                 n++;
             }
             s1[n]='\0';
             z++;
         }
             if(strcmp(s1,s2)==0)
            
                 printf("pass");
                
            
             else
                 printf("fail");
        
     }
}
2008-04-28 21:47
快速回复:下面程序用'*'怎么回显
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017382 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved