Q&A Discussions
Cin/cout/cerr
0 Votes
1 AnswerNo output in my code???
0 Votes
3 AnswersIf-else problem
1 Vote
6 AnswersExecution time
1 Vote
1 AnswerC++ Question
3 Votes
3 AnswersC++ Question
3 Votes
1 AnswerWhat is wrong with this
0 Votes
2 AnswersHow can declare a word?
0 Votes
2 AnswersWhat's wrong?!
2 Votes
3 AnswersPost- cin Text?
0 Votes
3 AnswersIn the code below the output is 2. This code is used in a challenge and I get an error when I select the answer 2. It accepts as correct the answer 1 which I believe is wrong. If you agree please thumbs up.
If you find any other errors please post them here!
#include <iostream>
using namespace std;
int main()
{
for(int i=1; i>=1; i++) {
if(i<1 || i>1){
cout << i;
break;
}
}
return 0;
}
8 Votes
8 Answerscan anyone plz explain me this program step by step?#include <iostream>
using namespace std;
class MyClass {
public:
int var;
MyClass() { }
MyClass(int a)
: var(a) { }
MyClass operator+(MyClass &obj) {
MyClass res;
res.var= this->var+obj.var;
return res;
}
};
int main() {
MyClass obj1(12), obj2(55);
MyClass res = obj1+obj2;
cout << res.var;
}I am not getting the part inside operator+
0 Votes
8 AnswersWhy it doesn't work?!
2 Votes
5 AnswersHot today
Pig Latin
0 Votes
Please rate my code from 1 to 10
2 Votes
Square Roots
0 Votes
What's wrong with this?
1 Votes
Uuu
2 Votes
How to start
0 Votes
I’m new someone can help me
0 Votes