C++ (Qt)int a = 1;int b = 2; cout<<++a+b--<<endl;
C++ (Qt)void f(string & s){ cout<<s<<endl;}...f("hello");
C++ (Qt)//Решение, но цепляются и просят другие вариантыvoid f(const string & s)
C++ (Qt) vector<int> v; v.reserve(10); for(int i=0;i<10;++i) v[i]=1; v.push_back(2); for(auto a:v) cout<<a<<endl;}
C++ (Qt) char* a=new char[10]; if(a) { delete a; }}
C++ (Qt) struct A { virtual void f(){cout<<"A"<<endl;} }; struct B { void f(){cout<<"B"<<endl;} }; struct C:A,B { void f(){cout<<"C"<<endl;} };... A* a = new C(); B* b = new C();
C++ (Qt) template<class T> struct A { virtual void f(){T()();} }; struct B { void operator()(){cout<<"B"<<endl;} }; struct C:B { void operator()(){cout<<"C"<<endl;} }; template<> struct A<B> { void f() { cout<<"A"<<endl; } };... A<B>().f(); A<C>().f();
C++ (Qt) struct A { A() { cout<<"construct"<<endl; } A(const A&) { cout<<"copy"<<endl; } A& operator=(const A&) { cout<<"assign"<<endl; return *this; } }; A f() { return A(); }... A a1 = f(); A a2 = a1;
int * a = &vec[0]; if (a) {...