fork download
  1. #include <iostream>
  2. using namespace std;
  3. class Hello{
  4. int x;
  5. public:
  6. void hello_world();
  7. void set_values(int);
  8. };
  9.  
  10. void Hello::hello_world(){cout<<"Hello World! This is the set number: "<<x<<endl;}
  11. void Hello::set_values(int a){x=a;}
  12.  
  13. int main(){
  14. Hello example_variable;
  15. example_variable.set_values(10);
  16. example_variable.hello_world();
  17. return 0;
  18. }
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
Hello World! This is the set number: 10