わかりましたので、100 の選択された単語を含むテキスト ファイルを読み、次に別の「テキスト」ファイルを読み込んで、それらの 100 の選択された単語のうちのいくつが「テキスト」ファイルに表示され、どれが最も長いかを比較する宿題をしています。最短の単語と、それらの選択された単語がテキスト ファイルに含まれる回数。私は完全な助けが必要です。これは私がこれまでに得たものです。ちなみに、選択したファイルをまだ入力していないので、ifsステートメントが不完全です
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
int main ()
{
int fileNumber;
string Words [100];
string wordCounts [100];
string Frequencies [100];
string shortest = "abcdefghijklmnopqrstuvwxyz";
string longest = "";
int totalWordCount = 0;
ifstream inData;
int I=0;
inData.open("SelectWords.txt");
while ( !inData.eof () ) {
inData >> Words [I];
}
int irow;
while ( irow=0, irow<=100, irow++) {
cout<<Words[I]<<endl;
}
cout<<"Choose a file you want to open"<<endl;
cout<<"1= A Modest Proposal"<<endl;
cout<<"2=Apology" <<endl;
cout<<"3=The Call of the Wild"<<endl;
cout<<"4=The Adventures of Tom Sawyer"<<endl;
cin>> fileNumber;
while ((fileNumber<1) || (fileNumber>4))
{
cout<<"Error please try again"<<endl;
cout<<"Choose a file you want to open"<<endl;
cout<<"1 - A Modest Proposal"<<endl;
cout<<"2 - Apology" <<endl;
cout<<"3 - The Call of the Wild"<<endl;
cout<<"4 - The Adventures of Tom Sawyer"<<endl;
cin>> fileNumber;
}
if (fileNumber==1)
{
}
if (fileNumber==2)
{
}
if (fileNumber==3)
{
}
if (fileNumber==4)
{
}
system ("pause");
return 0;
}