Hello, i am very interested in the c++ language, i decided to make my own small program and test how arrays work with classes with private variables and private operations and then calling them any way i'd like from the main function.
a very big reason about this is probably because i'm trying to pass by reference, which i thought was necesary if i'm keeping the changes everywhere within the program, and using a void function. If there is any advice as to coding better, i'd like those too.
there are syntax errors, line 20 only, please help me :)
////.header file for class arrays.
#include <string>
using namespace std;
class arrays {
private:
string hold;
int keep;
int raekwon[];
public:
void Talk(string&, int&);
};
///this is my arrays header function
#include "arrays.h"
void arrays::Talk(hold&, keep&) {
///this creates the array based from the size parameter
raekwon[keep];
//this displays the information
cout << "okay, you are feeling " << hold << " today.\n";
cout << "also, the size of the array you asked for is " << keep << "\n";
cout << "the elements in the array are: " << raekwon << "\n";
}
///this is the main function
#include "arrays.h"
#include <iostream>
#include <string>
using namespace std;
main()
{
arrays a;
string feelings;
int array_size;
cout << "how are you feeling today?\n";
cin >> feelings;
cout << "\n" << "what size array you want?\n";
cin >> array_size;
a.Talk(feelings&, array_size&);
return 0;
}
//////////////////////////////////////////////////