Hi! I tryed to write down some code of C++, but i have some problems...
...actually i am in my first 5 programs in C++ so i may have stupid mistakes...
Code:
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
class Data{
private:
int age;
char name;
public:
init();
printAll();
};
void init(class Data info)(
info.age = 20;
info.name = "Vasilis";
}
int main(void){
Data info;
cout << "Hello there! \n";
init(info);
// printAll(info); *i will declare this later!
return 0;
}
and my output is:
Code:
program.cpp:12: error: ISO C++ forbids declaration of ‘init’ with no type
program.cpp:13: error: ISO C++ forbids declaration of ‘printAll’ with no type
program.cpp:17: error: function ‘void init(Data)’ is initialized like a variableprogram.cpp:17: error: ‘info’ was not declared in this scope
program.cpp:18: error: expected constructor, destructor, or type conversion before ‘.’ token
program.cpp:19: error: expected declaration before ‘}’ token
so, can anyone help me please...? thanks in advance...