吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 4475|回复: 11
收起左侧

[C&C++ 转载] system (" cls ");的问题

[复制链接]
神马勾 发表于 2017-4-13 16:29
我是用VS2010编译的  system (" cls ");不注释掉就出错 错误提示
1>d:\documents\visual studio 2010\projects\游戏\游戏\1111.c(13): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)
>d:\documents\visual studio 2010\projects\游戏\游戏\1111.c(15): error C2065: “i”: 未声明的标识符
1>d:\documents\visual studio 2010\projects\游戏\游戏\1111.c(17): error C2065: “j”: 未声明的标识符
1>d:\documents\visual studio 2010\projects\游戏\游戏\1111.c(17): error C2065: “j”: 未声明的标识符
1>d:\documents\visual studio 2010\projects\游戏\游戏\1111.c(17): error C2065: “j”: 未声明的标识符
1>d:\documents\visual studio 2010\projects\游戏\游戏\1111.c(19): error C2065: “i”: 未声明的标识符
1>d:\documents\visual studio 2010\projects\游戏\游戏\1111.c(19): error C2065: “j”: 未声明的标识符
1>d:\documents\visual studio 2010\projects\游戏\游戏\1111.c(22): error C2065: “i”: 未声明的标识符
1>d:\documents\visual studio 2010\projects\游戏\游戏\1111.c(22): error C2065: “j”: 未声明的标识符
[C] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
# include <stdlib.h>
 
 
 
 
 
 
void print  (int a[][33])
{
 
    //system (" cls ");   不注释就编译出错
    int i , j ;
 
    for (i=0;i<13;i++)
    {
        for (j=0;j<33;j++)
        {
            if (a[i][j]==0)
             printf("");
             
            if (a[i][j]==1)
             printf("*");
             
        }
        printf("\n");
    }
   
 
}
void main ()
{
    int scr [13][33] ={0};
    int proistion_x,proistion_y;
    proistion_x = 5;
    proistion_y = 20;
 
    scr[proistion_x][proistion_y] = 1;
    print(scr);
 
   while(proistion_x<13)
    {
      scr[proistion_x][proistion_y] = 0;
      proistion_x++;
      scr[proistion_x][proistion_y] = 1;
      print(scr);
    }
     
 
}

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

lipss 发表于 2017-4-14 20:23
神马勾 发表于 2017-4-13 17:36
谢谢  编译成功了

...大神,你就是少了个头文件而已呀。。

加上这个就编译过去了。VA插件装一装呗

[C++] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// for循环逆向.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <string.h>
#include <stdlib.h>
 
 
 
void print(int a[][33])
{
 
    system ("cls");   //不注释就编译出错
    int i, j;
 
    for (i = 0; i < 13; i++)
    {
        for (j = 0; j < 33; j++)
        {
            if (a[i][j] == 0)
                printf("");
 
            if (a[i][j] == 1)
                printf("*");
 
        }
        printf("\n");
    }
 
 
}
void main()
{
    int scr[13][33] = { 0 };
    int proistion_x, proistion_y;
    proistion_x = 5;
    proistion_y = 20;
 
    scr[proistion_x][proistion_y] = 1;
    print(scr);
 
    while (proistion_x < 13)
    {
        scr[proistion_x][proistion_y] = 0;
        proistion_x++;
        scr[proistion_x][proistion_y] = 1;
        print(scr);
    }
 
 
}

头像被屏蔽
hejialong 发表于 2017-4-13 16:47
我的女神好可爱~ 发表于 2017-4-13 16:40
应该是缺少一个头文件什么的吧,具体百度一下。
Akesudia 发表于 2017-4-13 17:03
windows.h加上试试
 楼主| 神马勾 发表于 2017-4-13 17:04

加了  也不行
 楼主| 神马勾 发表于 2017-4-13 17:07
hejialong 发表于 2017-4-13 16:47
[mw_shl_code=c,true]#include
#include
void print  (int a[][33])

我这编译就出错 不知道为什么
Akesudia 发表于 2017-4-13 17:08

那就不知道了,我用cfree试了可以。
 楼主| 神马勾 发表于 2017-4-13 17:24
百度搜了一圈也没找到解决办法
yemoon 发表于 2017-4-13 17:25
必竟是C语言,不是C++,还是把system("cls");放到 int i, j; 之后吧
 楼主| 神马勾 发表于 2017-4-13 17:36
yemoon 发表于 2017-4-13 17:25
必竟是C语言,不是C++,还是把system("cls");放到 int i, j; 之后吧

谢谢  编译成功了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-7-29 20:30

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表