有趣的思考题

    xiaoxiao2021-03-25  60

    饭前看到一个有趣的小问题,水一发~~ 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
    转载请注明原文地址: https://ju.6miu.com/read-27445.html

    最新回复(0)