Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- FILE *fp; // File pointer
- fp = fopen("C:\\Users\\carniavl\\Desktop\\MIA-Task5\\Task 5\\Part A test cases\\invalid1.txt", "r"); // Function for opening the file and setting it to read only
- if (fp == NULL){ // In case we can't open the file
- printf("Could not open file ");
- return 1;
- }
- char Game[18][9];
- int i, j;
- for (i = 0; i < 18; i++){
- for (j = 0; j < 9; j++){
- fscanf(fp, "%c" ,&Game[i][j]);
- }
- }
- for (i = 0; i < 18; i++){
- for (j = 0; j < 9; j++){
- printf("%c",Game[i][j]);
- }
- }
- if (Game[18][9] < '9' && Game[18][9] > '0'){
- printf("\nThe Game Has Only Integers");
- }
- else {
- printf("\nThe Game contains other symbols than Integers");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment