What is the output of the C ++ program. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 4

What is the output of the C ++ program.

* What is the output of the C ++ program ?? * what's Attributes ?? * what's Methods ?? #include <iostream.h> class Machin { public : int bidule ; Machin(int b) { cout << " ++ Machin normal " << endl ; bidule = b ;} ~Machin() { cout << " -- Machin normal " << endl ; } } ; void main() { Machin m (1) ;}

13th Oct 2020, 1:00 PM
Mohammed Elhafed Messini
Mohammed Elhafed Messini - avatar
1 Answer
0
Try writing your code neatly. Also, it will produce error as you are not using namespace std. Another thing is as far as I know, main function cannot return void. For the question, just clean it a bit. And it will output: ++ Machin normal -- Machin normal Here is the clean code #include <iostream> using namespace std; class Machin { public : int bidule; Machin(int b) { cout << " ++ Machin normal " << endl; bidule = b ; } ~Machin() { cout << " -- Machin normal " << endl; } }; int main() { Machin m(1); return 0; }
26th Feb 2021, 8:33 AM
Jizza Abayon
Jizza Abayon - avatar