Question: Instructions listed below. I have built the program but I am receiving the errors listed below, and unsure how to resolve them. Program has to

Instructions listed below. I have built the program but I am receiving the errors listed below, and unsure how to resolve them. Program has to compile in Visual Studio 17. Assignment instructions listed after code.

>c:\users\mckinley\desktop\projects\loops\loops\source.c(64): warning C4133: 'function': incompatible types - from 'char [3]' to 'FILE *const '

1>c:\users\mckinley\desktop\projects\loops\loops\source.c(64): warning C4133: 'function': incompatible types - from 'int *' to 'const char *const '

1>c:\users\mckinley\desktop\projects\loops\loops\source.c(58): fatal error C1075: the left brace '{' was unmatched at the end of the file

1>Done building project "Loops.vcxproj" -- FAILED.

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

#include

void ploop();

void wtf(fname);

void rff(fname);

int main()

{

char fname[20] = "MyOutput.txt";

ploop();

wtf(fname);

rff(fname);

return 0;

}

void ploop()

{

int i, j;

for (i = 9; i >= 1; i--)

{

for (j = 1; j <= i; j++)

{

printf("%d ", j);

}

printf(" ");

}

}

void wtf(char *fname)

{

FILE *MyOutput;

int i;

int j;

fopen_s(&MyOutput, "MyOutput.DAT", "w");

for (i = 9; i >= 1; --i)

{

for (j = 1; j <= i; ++j)

{

fprintf(MyOutput, "%d", j);

}

fprintf(MyOutput, " ");

}

fclose(MyOutput);

}

void readfromFile(char *fname)

{

FILE *MyOutput;

int num;

char ch;

fopen_s(&MyOutput, "MyOutput.Dat", "r");

while (fscanf_s("%d", &num, sizeof(num)) > 0)

{

if ((num % 2) != 0)

printf("%d", num);

fscanf_s(MyOutput, "%c", &ch);

printf("%c", ch);

}

fclose(MyOutput);

Write a well-documented program that will perform following 3 steps in separate functions for each.

Print following pattern using loops.

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8

1 2 3 4 5 6 7

1 2 3 4 5 6

1 2 3 4 5

1 2 3 4

1 2 3

1 2

1

After displaying the output on the monitor, also write above pattern to a text file named MyOutput.txt.

Read from MyOutput.txt and display only the odd numbers on the monitor.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!