//I am haing trouble creating this program. There is basically only one part that I can't figure out. I need to match up my array to my string. I need something that will force the first strings in each to equal eachother, then use a counter to match the rest. I know it needs to be a DO loop. Maybe something like:
//for (code[1] == code2[1]; counter++;
//or
//for (code[counter] == code2[counter]; counter++;
//This is what I have so far:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
int counter;
int counter2;
int code[26];
string code2[26];
string word;
int sWord;
char letter;
int i;
bool quit = false;
ifstream inNumData;
ifstream inStrData;
inNumData.open("code.txt");
inStrData.open("code2.txt");
for (counter = 0; counter < 25; counter++)
{
inNumData >> code[counter];
}
for (counter2 = 0; counter2 < 25; counter2++)
{
inStrData >> code2[counter2];
}
do
{
for (code[1] = code2[1];
counter++;
}
inNumData.close("code.txt");
inStrData.close("code2.txt");
cout << "A - Convert a word into secret code." << endl;
cout << "B - Convert a secret code back into a word." << endl;
cout << "C - Quit Program." << endl;
cout << "Please enter your choice: ";
cin >> letter;
switch (letter)
{
case 'A':
case 'a':
cout << "Enter the word to be converted into secret code." << endl;
cin >> word;
cout << sWord << endl;
break;
case 'B':
case 'b':
cout << "Enter a secret code to be converted to the word." << endl;
cin >> sWord;
cout << word << endl;
break;
case 'C':
case 'c':
quit = true;
}
return 0;
}