Hey all I am writing this program and I am trying to read in a group of names from a file example:
Peter
Mike
Juan
Valentino
Stephanie
I need to read each name one by one and look at for example the first one P then compare it to see if it is one of a group of suggested letters to perform manipulations on.
Suggested letters;
A,B,C,F,P,N,R,T,
Values of letters A=1,B=2,C=3, ...Z=26;
for example if A is in the word then the value of A is 1 and times it by 2, so new value is 2.
so in the first name Peter, P is one of the letters so perform a given task, and E is not so value is 0, and T is so do a certain manipulation, E is not so 0, and R is so perform a manipulation.
When ever i read in the strings i can get it to read in the whole name or just the first letter, but not each letter individually.
Any help with this would be great I think I can perform each manipulation to find the new value of the letter I just can't seem to get each name broken up into individual letters.
Here is what I have so far:
int main()
{
time_t t;
time(&t);
yl;
cls;
string name;
int len;
if (!infile)
{
cout << "An error has occurred while opening the file." << endl;
frz;
exit(1);
}
while (!infile.eof())
{
int i=0;
infile >> name;
if (i < name.length())
{
cout << name[i] << endl;
i++;
}
}
Thank you very much for your help.
Any posting help you can give me would be a great help