Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_DEPRECATE
- #include <iostream>
- using namespace std;
- int main()
- {
- FILE *fp;
- fp = fopen("C:\\myfiles\\sample3.txt", "w");
- // Check permission if you can write a file
- if(!fp)
- {
- cout << "Cannot open file.\n";
- system("pause");
- exit(1);
- fputc('\n', fp);
- }
- //Prints the Character ASCII value from 97 to 122 (a-z) to a file
- for (int i = 65;i<91;i++)
- fputc(i, fp);
- fputc('\n', fp);
- for (int i = 90; i >64; i--)
- fputc(i, fp);
- fputc('\n', fp);
- for (int i = 97; i < 123; i++)
- fputc(i, fp);
- fputc('\n', fp);
- for (int i = 97; i < 107; i++)
- fputc(i, fp);
- fclose(fp);
- system("pause>0");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement