| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1260 人关注过本帖
标题:atm机问题,输入任何数,没有输出
取消只看楼主 加入收藏
qmsb2580
Rank: 2
等 级:论坛游民
帖 子:54
专家分:20
注 册:2018-10-20
结帖率:83.33%
收藏
已结贴  问题点数:20 回复次数:1 
atm机问题,输入任何数,没有输出
#include<stdio.h>
#include<windows.h>
#include<stdlib.h>
#include<string.h>
void gotoxy(int x,int y);
void code();
void face();//界面函数声明
void realcode_face();

void gotoxy(int x,int y)
{
    COORD coord;
    coord.X=x;
    coord.Y=y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}    //光标定位函数


void code()
{
    long int code;
     gotoxy(12,5);
    scanf("%d",&code);
   
   
   
   
///////////////////////////////////////////////////////////   
    if(code!=123456)
    {   
        gotoxy(11,6);
        printf("对不起code错误");
    }
   
    else
    {
        gotoxy(11,6);
    printf("code right!");
    system("cls");
    realcode_face();
    }
/////////////////////////////////////////////////////////   
}


void face()  //界面函数
{
printf("*********************************************\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                 输入code                  *\n");
printf("*                                           *\n");//gotoxy(12,5);
printf("*     code:                                *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*********************************************\n");
}

void realcode_face()
{

   int choose;
printf("*********************************************\n");
printf("*                                           *\n");
printf("*            1.取款                         *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*            2.存款                         *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*  请输入:                                 *\n");
printf("*                                           *\n");
printf("*                                           *\n");
printf("*********************************************\n");
   //gotoxy();         //这个我
   scanf("%d",&choose);
   if((choose!=1)||(choose!=2))
   printf("请输入正确的标号!"); //就是这里,我不管输入什么数,没有任何输出,而且程序编译的时候没有报错!!!!!!!!!!!!!
   

}

int main()
{   
    face();
    code();
    gotoxy(1,15);
    return 0;
   
}
搜索更多相关主题的帖子: 输入 void int code printf 
2019-02-10 21:21
qmsb2580
Rank: 2
等 级:论坛游民
帖 子:54
专家分:20
注 册:2018-10-20
收藏
得分:0 
回复 2楼 wp231957
我的目的是输入不是标号意外的数,程序就输出(请输入正确的标号)
但是,这段代码不管输入任何数,输出都是这句话
2019-02-12 01:39
快速回复:atm机问题,输入任何数,没有输出
数据加载中...
 
   



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

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