C++ で構造体の配列を作成するのに問題があります。何らかの理由で、これはコンパイルされません。エラーは Fem 構造を指していますが、';' がないことが原因です。関数のヘッダーがありません。アイデアは、それぞれの内部に配列と文字列を含む構造体の配列を取得することです。これに関する任意の助けをいただければ幸いです。
/* Global headers and namespace */
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cstdlib>
#include <cctype>
using namespace std;
/* ================================================================ */
/* Global named constants */
const int NUM_ANSWERS = 10;
const int NUM_STRUCTS = 15;
/* ================================================================ */
/* Global type definitions */
// Two struct types, Male and Female
struct Male
{
int maleAnswers [NUM_ANSWERS];
string name;
};
struct Fem
{
int femAnswers [NUM_ANSWERS];
string name;
};
// Arrays of structs
typedef Fem FemList [NUM_STRUCTS];
typedef Male MaleList [NUM_STRUCTS];
/* ================================================================ */
/* global function prototypes */
void OutputHeader ();
void ReadFile (FemList, MaleList);
/* ================================================================ */
int main ()
{
FemList fList; // Array of Fem structs
MaleList mList; // Array of Male structs
void OutputHeader ();
void ReadFile (fList, mList);
}
void OutputHeader ()
{
cout << "==================================================================" << endl;
cout << "Welcome to the Cheap & Ineffective Dating Service of Tallahassee!" << endl << endl;
cout << " eDisHarmony.com" << endl;
cout << "==================================================================" << endl << endl;
cout << "<><><> Initial Client Data as Input <><><>" << endl << endl;
cout << setw(11) << "Sex" << setw(31) << "Answers" << "Name" << endl;
cout << setw(11) << "---" << setw(24) << "-------------------" << "--------------------" << endl;
}
void ReadFile (fList, mList)
{
}