Printing into text file not working

The program is suppose to print onto a text file, however, it never actually prints anything. Any suggestions would be great. If you need more information let me know in the comments


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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void){
	FILE *outp;
	double x1 = 0;
	double y1 = 0;
	double deltabetweenPoints = 0;
	double y = 0;
	double x = 0;
	double ytmp = 0;
	double xtmp = 0;
	double maxCount = 0;
	double maxZ = 0;
	double z = 0;
	double xC = 0;
	double yC = 0;
	int numberChar = 0;
	int numberLines = 0;

	printf("Opening file textfile.txt.\n");
	outp = fopen("textfile.txt", "w");

	printf("Please enter x-value for the point:");
	scanf("%lf", &x1);
	printf("Please enter y-value for the point:");
	scanf("%lf", &y1);
	printf("Please enter delta between points:");
	scanf("%lf", &deltabetweenPoints);

	// Open file
	

	if (outp == NULL)
	{
		printf("The input file does not exist\n");
	}
	else {
		y = y1;
		while (numberLines < 75); {
			x = x1;
			for (numberChar = 0; numberChar < 75; ++numberChar){

				xC = x;
				yC = y;

				if (maxCount <= 500){
					xtmp = pow(xC, 2) - pow(yC, 2) + x;
					ytmp = 2 * yC * xC + y;
					xC = xtmp;
					yC = ytmp;
					maxCount++;
				}
				z = sqrt(((x1*x1) + (y1*y1)));
				if (maxCount > 500) {
					if (z <= 10.0) {
						fprintf(outp, "*");
					}
					else {
						fprintf(outp, " ");
					}
					x = x + deltabetweenPoints;
				}
			}
			if (numberChar == 75){
				fprintf(outp, "\n");
				++numberLines;
			}
			y = y - deltabetweenPoints;
		}
	}
	fclose(outp);
	return 0;
}
line 42:
while (numberLines < 75); {

that stray semi-colon turns line 42 into an infinite loop.

Also, do you mean "output" in line 38? Doesn't affect the code, but if your UI is wrong, your product could be dangerous - this like putting "don't drink" on a bottle of coke and "quench your thirst" on a bottle of HCL - it doesn't affect the product itself, but...
Wow yip that semicolon was the problem! Thanks for the fast response.
Topic archived. No new replies allowed.