Page 1 of 1

What will happen when you attempt to compile and run the following code?#include <iostream>#include <set>#include <vecto

Posted: Wed Aug 03, 2022 9:20 am
by answerhappygod
What will happen when you attempt to compile and run the following code?#include <iostream>#include <set>#include <vector>using namespace std;int main(){int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };vector<int>v(t, t+10);set<int> s1(v.begin(),v.end());s1.insert(v.begin(),v.end());bool found = s1.find(7);if (found){cout<<"Element found!\n";}else {cout<<"Element not found!\n";}return 0;}

A. program will display "Element found!"
B. program will display "Element not found!\n"
C. code will not compile
D. changing type of variable found to int will make this code compile