C++求助
#include<iostream>using namespace std;
//定义一个宏常量
#define Day 7;
int main()
{
cout<<"hello world"<<endl;
; cout<<Day<<endl;
system("pause");
return 0;
}
这个程序为什么会报错呀
大佬们求助
本帖最后由 昨非 于 2021-1-9 17:45 编辑
lwj2580 发表于 2021-1-9 17:34
大佬们求助
宏定义只是起到简单的替换作用,#define Day 7;
相当于下面的cout<<7;<<endl;显然这样会报错的
#include<iostream>
using namespace std;
//定义一个宏常量
#define Day 7 //这里的;去掉
int main()
{
cout << "hello world" << endl;
cout << Day << endl;
system("pause");
return 0;
} 昨非 发表于 2021-1-9 17:43
宏定义只是起到简单的替换作用,#define Day 7;
相当于下面的cout
谢谢
页:
[1]