Given three files: class.h, class.cpp and main.cpp containing small C++ project, which sentences are TRUE if you attempt to compile and run the program? Assume that the whole compiling environment is properly set.
// File: main.cpp
#include
#include "class.h"
using namespace std;
int main()
{
A
cout << a.getV() << endl;
return 0;
}
//File: class.h
#ifndef _CLASS_
#define _CLASS_
template
class A {
T_v;
public:
A() {}
A(T v);
T getV();
};
#endif
//File: class.cpp
#include "class.h"
template
A
template
T A
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main ()
{
list
deque
for(int i=0; i<5; i++)
{
l1.push_back(i);l1.push_front(i);
d1.push_back(i);d1.push_front(i);
}
for(int i=0; i { cout< } cout< return 0; }
What will happen when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main(){
int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };
vector
multiset
multiset
for(multiset
cout<<*i<<" ";
}
for(multiset
cout<<*i<<" ";
}
cout< return 0; } The output will be:
What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: one two three
#include
#include
using namespace std;
int main ()
{
string a;
cin>>a;
cout< return 0; } Program will output:
Which sentence is correct about the code below?
#include
#include
#include
using namespace std;
class A {
int a;
public:
A(int a) : a(a) {}
int getA() const { return a; }
void setA(int a) { this?>a = a; }
/* Insert Code Here */
};
struct add10 { void operator()(A & a) { a.setA(a.getA() + 10); } };
int main() {
int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 };
vector v1(t, t + 10);
for_each(v1.begin(), v1.end(), add10());
vector::iterator it = find(v1.begin(), v1.end(), A(7));
cout << it?>getA() << endl;
return 0;
}
Rabia Qureshi
1 month agoFatima Nawaz
2 months agoLisa Rodriguez
3 months agoHyun Kim
3 months agoSharon Garcia
4 months agoEmi Hoang
4 months agoPatricia Lee
5 months agoNicolas Sidorov
5 months agoSharon Hall
6 months agoMatthew Morris
7 months agoKaren Hernandez
7 months agoEmma Reed
7 months agoJoseph Harris
7 months agoNancy Bailey
7 months agoWilliam Gonzalez
7 months agoAndrew Nguyen
7 months agoLoise
8 months agoKyoko
8 months agoDevora
8 months agoCarlota
9 months agoFletcher
9 months agoMajor
9 months agoGwen
9 months agoKris
10 months agoDonte
10 months agoKimberlie
10 months agoMarquetta
10 months agoGlory
11 months agoFatima
11 months agoOmega
11 months agoKristin
11 months agoPaz
12 months agoRose
12 months agoMarge
1 year agoGail
1 year agoDaren
1 year agoTarra
1 year agoFannie
1 year agoPearlie
1 year agoDonte
1 year agoSilva
1 year agoGiuseppe
1 year agoAileen
1 year agoSabra
1 year agoAnnmarie
1 year agoBuffy
1 year agoDyan
2 years agoSalena
2 years agoSalley
2 years agoArlean
2 years agoCaren
2 years agoAleisha
2 years agoLanie
2 years agoJohnetta
2 years agoChristiane
2 years agoStanford
2 years agoYuette
2 years agoDallas
2 years agoIndia
2 years agoAleisha
2 years agoRoselle
2 years agoVincenza
2 years agoLyda
2 years agoNoah
2 years agoMammie
2 years agoThea
2 years agoArlean
2 years agoMargarita
2 years ago