#include <iostream>
#include <string>
#include <math.h>
#include <fstream>
using namespace std;
class Storage
{
public:
Storage();
string information[10][7];
void SetInformation(string,int);
void GetInformation(int);
};
Storage::Storage(){cout<<"\nStorage Activated\n";}
void Storage::SetInformation(string,int i)
{//input
i--;
for (int j=0;j<7;j++)
{
switch(j+1)
{case 1: cout << "\nFirst Name: "; break;
case 2: cout << "\nLast Name: "; break;
case 3: cout << "\nAge: "; break;
case 4: cout << "\nEmail: "; break;
case 5: cout << "\nDoor Number: "; break;
case 6: cout << "\nRoad Name: "; break;
case 7: cout << "\nPost Code: "; break;
default:;}
cin >> information[i][j];}
}
void Storage::GetInformation(int i){
// output
i--;
for (int j=0;j<7;j++)
{
switch(j+1)
{case 1: cout << "\nFirst Name: "; break;
case 2: cout << "\nLast Name: "; break;
case 3: cout << "\nAge: "; break;
case 4: cout << "\nEmail: "; break;
case 5: cout << "\nDoor Number: "; break;
case 6: cout << "\nRoad Name: "; break;
case 7: cout << "\nPost Code: "; break;
default:;}
cout << information[i][j];}
}
int main()
{
int x;
Storage();
Storage Someone;
cin >> x;
Someone.SetInformation(int);
return 0;
}
好的,这就是我现在所做的。但是我现在在激活课程时遇到问题?我的意思是我不能使用该类或其方法?我是否也以正确的方式创建了这些类?