Hello everyone!
I hope someone can help me. I have a program to make using functions that will read in a list of single words from a sequential file so that it can calculate the word value based upon formulas for individual seleted letters. I am to manipulate each word in different ways which I think I can handle, but I don't know how to read in the words one by one in order to calculate and print the value of each words.
The problem is that I only get 1 out of every 2 letters. And if the word has an odd number of letter, I get garbage at the end. I think I may be going about it the wrong way. Can anybody help me?
Thank you in advance, it is much appreciated.
#include "a:bcc.h"
#define cls system ("cls")
//************************************************** *********************** type definitions
ofstream outfile; // Global definition of saving devices
ifstream infile;
//************************************************** *********************** function prototypes
void read(char warray[]);
//void print(char warray[], int &i);
//************************************************** *********************** main function
void main(void)
{
char word_array[21];
int count=0;
cls;
infile.open ("wordcalc.txt");
read(word_array);
// print(word_array, count);
} // END MAIN FUNCTION
//************************************************** *********************** function definitions
void read (char warray[])
{
int count=0;
while(infile.get() != '\n')
{
infile >> warray[count];
cout << warray[count];
count++;
}
cout << count;
infile.close();
} // END READ FUNCTION
//************************************************** ***********************
#include "a:bcc.h"
#define cls system ("cls")
//************************************************** *********************** type definitions
ofstream outfile; // Global definition of saving devices
ifstream infile;
//************************************************** *********************** function prototypes
void read(char warray[]);
//void print(char warray[], int &i);
//************************************************** *********************** main function
void main(void)
{
char word_array[21];
int count=0;
cls;
infile.open ("wordcalc.txt");
read(word_array);
// print(word_array, count);
} // END MAIN FUNCTION
//************************************************** *********************** function definitions
void read (char warray[])
{
int count=0;
while(infile.get() != '\n')
{
infile >> warray[count];
cout << warray[count];
count++;
}
cout << count;
infile.close();
} // END READ FUNCTION
//************************************************** ***********************
#include "a:bcc.h"
#define cls system ("cls")
//************************************************** *********************** type definitions
ofstream outfile; // Global definition of saving devices
ifstream infile;
//************************************************** *********************** function prototypes
void read(char warray[]);
//void print(char warray[], int &i);
//************************************************** *********************** main function
void main(void)
{
char word_array[21];
int count=0;
cls;
infile.open ("wordcalc.txt");
read(word_array);
// print(word_array, count);
} // END MAIN FUNCTION
//************************************************** *********************** function definitions
void read (char warray[])
{
int count=0;
while(infile.get() != '\n')
{
infile >> warray[count];
cout << warray[count];
count++;
}
cout << count;
infile.close();
} // END READ FUNCTION
//************************************************** ***********************
#include "a:bcc.h"
#define cls system ("cls")
//************************************************** *********************** type definitions
ofstream outfile; // Global definition of saving devices
ifstream infile;
//************************************************** *********************** function prototypes
void read(char warray[]);
//void print(char warray[], int &i);
//************************************************** *********************** main function
void main(void)
{
char word_array[21];
int count=0;
cls;
infile.open ("wordcalc.txt");
read(word_array);
// print(word_array, count);
} // END MAIN FUNCTION
//************************************************** *********************** function definitions
void read (char warray[])
{
int count=0;
while(infile.get() != '\n')
{
infile >> warray[count];
cout << warray[count];
count++;
}
cout << count;
infile.close();
} // END READ FUNCTION
//************************************************** ***********************