对Visual c ++ 6.0进行哪些更改 [英] what changes to be made for visual c++ 6.0

查看:92
本文介绍了对Visual c ++ 6.0进行哪些更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在borland c ++编译器中编译并执行了以下c代码.它可以完美地工作,但不能在Visual c ++ 6.0编译器中工作.要使其在Visual c ++ 6.0中工作,需要进行哪些更改?

I''ve compiled and executed the following c code in borland c++ compiler. It works in it perfectly but it is not working in visual c++ 6.0 compiler. What changes are to be made to make it work in visual c++ 6.0?

#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
 
int main()
{
    char buffer[256] = {0};
    char password[] = "password";
    char c;
    int pos = 0;
 
    printf("%s", "Enter password: ");
    do {
        c = getch();
 
		  if( isprint(c) )
        {
            buffer[ pos++ ] = c;
            printf("%c", '*');
        }
        else if( c == 8 && pos )
		  {
            buffer[ --pos ] = '\0';
            printf("%s", "\b \b");
        }
	 } while( c != 13&& pos < 256 );
 
    if( !strcmp(buffer, password) )
        printf("\n%s\n", "Logged on succesfully!");
    else
        printf("\n%s\n", "Incorrect login!");
 
    return 0;
}

推荐答案

在Visual c ++ 6.0编译器中不起作用"是什么意思?

它可以编译但不能运行吗?
它可以编译但会抛出错误吗?如果是这样,错误是什么?
不编译吗?如果是这样,再一次出现什么错误?
What does ''it is not working in visual c++ 6.0 compiler'' mean?

Does it compile but not run?
Does it compile but throw errors? If so what are the errors?
Does it not compile? If so, once again, what are the errors?


看起来像conio.h头文件在这里可能是个问题.在Visual C ++编译器中,它与"getch()"函数一起不可用.您需要使用getchar().
Looks like conio.h header file might be an issue here. It is not available under Visual C++ compilers along with "getch()" function. You need to use getchar().


这篇关于对Visual c ++ 6.0进行哪些更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆