Here is what I have so far:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
const int MAX_TOKENS_PER_STRING = 50;
const string INPUT_FILE = "p01.txt";
const char SPLIT_DELIMITER = ' ';
//Function Prototypes
// This function makes the connection between the filename and its handle.
// It returns true to indicate a successful connection, or false otherwise.
bool ConnectInputFile(ifstream& fin, const string& filename);
// This function takes a string and breaks it into tokens (words), using
// the supplied delimiter. Each token is placed into the array tokens.
void SplitStringIntoTokens(const string& stringToSplit, string tokens[],
int& numberOfTokens, const char& delimiter);
// This function takes a word and returns the word reversed. For example,
// if "pots" is passed in, then "stop" is returned.
string ReverseTheString(const string& str);
int main()
{
string backwards;
int wordcount;
string sentence[49];
ifstream fromfile;
ConnectInputFile(fromfile, INPUT_FILE);
getline(fromfile, backwards);
while(!fromfile.eof())
{
cout << backwards << endl;
SplitStringIntoTokens(backwards, sentence, wordcount, SPLIT_DELIMITER);
//ReverseTheString()
//for
getline(fromfile,backwards);
}
return 0;
}// end main()
bool ConnectInputFile(ifstream& fin, const string& filename)
{
fin.open(filename.c_str());
return fin.is_open();
if(fin.fail())
{
return (false);
cout << "Error opening the file p01.txt " << endl;
}
else
return(true);
}
void SplitStringIntoTokens(const string& stringToSplit, string tokens[],
int& numberOfTokens, const char& delimiter)
{
}
string ReverseTheString(const string& str)
{
//only have this because i have to return a value
return("hello2");
}
This is the Debugger output I receive after running the code:
'p01.exe': Loaded 'C:\Documents and Settings\Crashem'\My Documents\Visual Studio 2010\Projects\p01\Debug\p01.exe', Symbols loaded.
'p01.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'p01.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'p01.exe': Loaded 'C:\WINDOWS\system32\msvcp100d.dll', Symbols loaded.
'p01.exe': Loaded 'C:\WINDOWS\system32\msvcr100d.dll', Symbols loaded.
The program '[3056] p01.exe: Native' has exited with code 0 (0x0).

New Topic/Question
Reply




MultiQuote




|