#include <iostream>
#include <fstream>
#include <cstring>
usingnamespace std;
int main()
{
ifstream member;
ofstream dogs;
ofstream cats;
int n=0;
int r=0,f=1,g=2,k=3,p=4,h=5;
string x[100];
int y[100];
dogs.open("file.txt",ios::out);
member.open ("file.txt",ios::in);
cats.open("file2.txt",ios::out);
member>> x[n]; //here you read the first character to x[0]
while (x[n]=="a"||x[n]=="e"||x[n]=="i"||x[n]=="o"||x[n]=="u")/*here you
loop untill the first consonant, then stop(if the first character in file.txt isn't
a vowel it will do nothing*/
{
if(x[n]=="a")/*here you check if that character is equal to the memory
address of the string literal "a"*/
{
y[n]=f;
}
if(x[n]=="e")/*here you check if that character is equal to the memory
address of the string literal "e"*/
{
y[n]=g;
}
if(x[n]=="i")/*here you check if that character is equal to the memory
address of the string literal "i"*/
{
y[n]=k;
}
if(x[n]=="o")/*here you check if that character is equal to the memory
address of the string literal "o"*/
{
y[n]=p;
}
if(x[n]=="u")/*here you check if that character is equal to the memory
address of the string literal "u"*/
{
y[n]=h;
}
cout<<y[n] <<"";/* here you output that number and then an empty
string (numbers will be contancatented(srry for bad english))*/
n++;/* here you increment n so in the next iteration x[n] will contain
uninitailzed random data*/
}
member.close();
for(int s=0;s<r;s++)// here you loop from 0 to 0, so nothing happens
{
cats<<y[s]<<"";
}
}
So, based on those errors, I suggest you repost this in the "begginners" section, where those who answer will understand you, and I, I won't lie to you, I just don't have the patiense. Sorry.
PS: You shoual also read this page's tutorial: http://www.cplusplus.com/doc/tutorial/