構造Route.hを作成しました
#include "stdafx.h"
using namespace std;
struct Route {
string startPoint;
string endPoint;
int number;
};
この構造を関数に渡す必要があります。私は参照を使用しました:
void CreateRoute(Route &route)
{
int start = rand() % 10;
int end = rand() % 10;
if (start == end)
{
while(true)
{
end = rand()%10;
if(end != start) break;
}
}
route.startPoint = SetPoint(start);
route.endPoint = SetPoint(end);
route.number = SetNumber();
}
しかし、ポインタを使用する方が良い方法のようですが、ポインタを使用する方法がわかりませんか?