VC++求助!!

来源:百度知道 编辑:UC知道 时间:2024/06/06 16:23:53
1. C的源程序是这样的,怎么能把它改成VC下能运行的啊,VC刚开始学,请高手指教!!
#include <stdio.h>
#include <math.h>
#include <conio.h>

main()
{
int a[8]; /***定义数组,用以存放8位信息位***/
int i,j,k,sum;
sum=1; /***sum即监督位,其值定为1***/

clrscr(); /***清屏函数***/
printf("please input the information bit:\n");
for(i=0;i<8;i++) /***for循环,用于接收8位信息的输入***/
{
scanf("%d",&a[i]);
}

printf("the information bit have inputed comletely\n");
printf("the check bit is '1'\n");

printf("if there is a Even check,please input '0'\n");
printf("if there is a Odd check,please input '1'\n");

scanf("%d",&a[8]);

vc下面使用图形界面可以用dc.textout来输出
如果是控制台的话,程序如下
// 2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream.h"
#include "math.h"
#include "stdlib.h"

int main(int argc, char* argv[])
{
int a[8]; /***定义数组,用以存放8位信息位***/
int i,j,k,sum;
sum=1; /***sum即监督位,其值定为1***/

system("CLS"); /***清屏函数***/
printf("please input the information bit:\n");
for(i=0;i<8;i++) /***for循环,用于接收8位信息的输入***/
{
scanf("%d",&a[i]);
}

printf("the information bit have inputed comletely\n");
printf("the check bit is '1'\n");

printf("if there is a Even check,please input '0'\n");
printf("if there is a Odd check,please input '1'\n");

scanf("%d",&a[8]); /***扫描