clmlbx
Technomancer
1.
problem is ..... in above programme I have put condition " l<=164 ".........but I want to put condition till end of file .so when ever i use
" in.eof()!=0 " ...programme does not work..........
2. can there be a programme can give some type of processor error.......
what's wrong in this......
Code:
#include<fstream.h>
main()
{
ifstream in("file.txt");
ofstream out("fi.txt");
char item[20];
int count;
for(count=1;count<=164;count++)
{
in>>item;
out<<item<<" ";
in>>item;
out<<item<<" ";
in>>item;
out<<item<<" ";
}
in.close();
out.close();
return 0;
}
problem is ..... in above programme I have put condition " l<=164 ".........but I want to put condition till end of file .so when ever i use
" in.eof()!=0 " ...programme does not work..........
2. can there be a programme can give some type of processor error.......
what's wrong in this......
Code:
#include<fstream.h>
main()
{
int l;
char ch[25];
char c;
char name1[25];
char name2[25];
cout<<"Enter full address and file name wih extention ";
cout<<"\n\nEnter the infile name : ";
cin>>name1;
cout<<"\n\nEnter the outfile name : ";
cin>>name2;
ifstream in;
ofstream out;
in.open(name1);
out.open(name2);
for(l=1;l<=164;l++)
{
in.get(ch[l]);
c=ch[l];
switch(c)
{
case 'a':
ch[l]='e';
break;
case 'b':
ch[l]='o';
break;
case 'c':
ch[l]='f';
break;
case 'd':
ch[l]='p';
break;
case 'e':
ch[l]='g';
break;
case 'f':
ch[l]='q';
break;
case 'g':
ch[l]='h';
break;
case 'h':
ch[l]='r';
break;
case 'i':
ch[l]='i';
break;
case 'j':
ch[l]='s';
break;
case 'k':
ch[l]='j';
break;
case 'l':
ch[l]='t';
break;
case 'm':
ch[l]='a';
break;
case 'n':
ch[l]='u';
break;
case 'o':
ch[l]='b';
break;
case 'p':
ch[l]='v';
break;
case 'q':
ch[l]='c';
break;
case 'r':
ch[l]='w';
break;
case 's':
ch[l]='d';
break;
case 't':
ch[l]='x';
break;
case 'u':
ch[l]='k';
break;
case 'v':
ch[l]='y';
break;
case 'w':
ch[l]='l';
break;
case 'x':
ch[l]='z';
break;
case 'y':
ch[l]='m';
break;
case 'z':
ch[l]='n';
break;
case 'A':
ch[l]='E';
break;
case 'B':
ch[l]='O';
break;
case 'C':
ch[l]='F';
break;
case 'D':
ch[l]='P';
break;
case 'E':
ch[l]='G';
break;
case 'F':
ch[l]='Q';
break;
case 'G':
ch[l]='H';
break;
case 'H':
ch[l]='R';
break;
case 'I':
ch[l]='I';
break;
case 'J':
ch[l]='S';
break;
case 'K':
ch[l]='J';
break;
case 'L':
ch[l]='T';
break;
case 'M':
ch[l]='A';
break;
case 'N':
ch[l]='U';
break;
case 'O':
ch[l]='B';
break;
case 'P':
ch[l]='V';
break;
case 'Q':
ch[l]='C';
break;
case 'R':
ch[l]='W';
break;
case 'S':
ch[l]='D';
break;
case 'T':
ch[l]='X';
break;
case 'U':
ch[l]='K';
break;
case 'V':
ch[l]='Y';
break;
case 'W':
ch[l]='L';
break;
case 'X':
ch[l]='Z';
break;
case 'Y':
ch[l]='M';
break;
case 'Z':
ch[l]='N';
default:
goto cont;
}
cont:out.put(ch[l]);
}
in.close();
out.close();
return 0;
}