main.cpp
#include <iostream>
#include "GZDemo.h"
using namespace std;
int main()
{
int array_values[5];
input(array_values,5);
show_input(array_values,5);
return 0;
}
GZDemo.h
#ifndef GZDEMO_H_INCLUDED
#define GZDEMO_H_INCLUDED
#include <iostream>
using namespace std;
void input(int [],int);
void show_input(int [],int);
void input(int values[],int len)
{
if(len > 5)
{
cout << "数组长度必须小于等于5!" << endl;
return;
}
string valueNmaes[] = {"体力","智力","魅力","道德","气质"};
for(int i = 0; i < len; i++)
{
cout << valueNmaes[i] << ":" << endl;
cin >> values[i];
}
}
void show_input(int values[],int len)
{
for(int i = 0; i < len; i++)
{
string valueNmaes[] = {"体力","智力","魅力","道德","气质"};
cout << valueNmaes[i] << ":" << values[i] << endl;;
}
}
#endif