-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabcfile.cpp
More file actions
41 lines (33 loc) · 717 Bytes
/
abcfile.cpp
File metadata and controls
41 lines (33 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<iostream>
#include<fstream>
using namespace std;
main()
{
cout<<"enter name of the file : ";
char name[10];
cin>>name;
fstream file;
file.open(name,ios::out);
char ch='a',CH='A';
if(!file)
cerr<<"error in opening file";
//file.open(name,ios_base::in);
for(int i=0;i<26;i++)
file<<(ch++)<<" ";
file<<endl;
for(int i=0;i<26;i++)
file<<CH++<<" ";
file<<endl;
ch='a';
CH='A';
for(int i=0;i<26;i++)
{
file<<ch++<<" :"<<ch+i<<" "<<CH++<<" :"<<ch-32+i; //using rule that characters changed into integers sfter any mathematical operation
file<<endl;
}
ios_base::iostate s=file.rdstate();
if(s==ios_base::failbit)
cout<<"failure";
cin.sync();
cin.get();
}