注册 登录
编程论坛 C++教室

新人求助,dve-C++

初学者2018 发布于 2018-04-27 01:54, 1824 次点击
求各位老师帮帮忙
我用dve-C++按课本编程,却怎么也编译不了
哪怕只是一段最简单的程序,也总是莫名的出现各种编译错误
举例1:
#include<iostream>
using namespace std;
int main()
{
    cout<<"Follow me to study C++!!!"<< end 1;
    system("pause");
    return 0;
}
错误原因如下:
E:\未命名1.cpp    [Error] 'end' was not declared in this scope

举例2:
#include <stdio.h>
int main(void)
{
    printf("你好,世界!!!")
   
    getchar();
    return 0;
}
错误原因如下:
E:\未命名1.cpp    [Error] expected ';' before 'getchar'
7 回复
#2
初学者20182018-04-27 02:05
找到举例2的原因了
在printf(“你好,世界!!!”);
后面少了一个分号
#3
初学者20182018-04-27 02:18
找到举例1的原因了
cout<<"Follow me to study C++!"<<endl;
其中end后面是小写L,不是阿拉伯数字1
太尴尬了
#4
yangfrancis2018-04-27 17:38
回复 楼主 初学者2018
endl是写在一起的,中间不能有空格
#5
yangfrancis2018-04-27 17:39
printf语句是因为末尾少了分号
#6
初学者20182018-04-29 12:42
回复 5楼 yangfrancis
谢谢,当时花了一点时间找到问题所在了
#7
hzr2018-05-30 20:25
做题还是要细心,
考试只有一次机会
1