qt开发环境

来源:互联网 发布:mac恢复出厂系统版本 编辑:程序博客网 时间:2024/05/21 11:27
#include <QCoreApplication>#include <iostream>using namespace std;//包含后就不用 std::cout了,直接coutnamespace ns1 {    int pram = 3;    void foo(void){        std::cout << "ns1 " << std::endl;    }}namespace ns2 {    int pram = 6;}namespace ns2 {    void foo(void){        std::cout << "ns2 " << std::endl;    }}int main(int argc, char *argv[]){    QCoreApplication a(argc, argv);    std::cout << "233" << std::endl;    std::cout << "666!" << std::endl;    std::cout << ns1::pram << std::endl;    std::cout << ns2::pram << std::endl;    ns1::foo();    ns2::foo();    using namespace ns1;//名字空间指令    std::cout << pram << std::endl;    foo();//    using namespace ns2;//引发歧义//    std::cout << pram << std::endl;//    foo();    using ns2::pram;//名字空间声明    std::cout << pram <<std::endl;    using ns2::foo;//名字空间声明    foo();//    using ns1::foo;//名字空间声明,这里会引起歧义//    foo();//    int x,y;//    std::cin >> x >> y;//    std::cout << x << '+' << y << " = " << x + y << std::endl;    return a.exec();}