饭前看到一个有趣的小问题,水一发~~
1.写一段C++程序,满足下列条件:
a.输出hello。b.删掉第一个字符,输出world。
2.写一段C++程序,满足下列条件:
a.输出hello。b.删掉最后一个字符,输出world。
思考中
……
……
……
……
……
……
……
……
……
……
……
……
……
……
……
1.
//*
#define hh
//*/
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
bool f=0;
#ifdef hh
f=1;
cout<<"hello"<<endl;
#endif
if(!f) cout<<"world"<<endl;
return 0;
}
2.
#include<stdio.h>
#include<iostream>
using namespace std;
#define hh int main(){puts("hello");}
#define h int main(){puts("world");}
hh