Another looping problem.

Same program as before. Here, my problem is that the "Birthday" statement doesn't appear and skips. The 'do you want...' statement appears right after 'Year-Section'. I can't find the problem here >.< [Ignore the forms and text colors codes]


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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <iostream.h> //header files
#include <conio.h>
#include <cstring>
#include <stdlib>
#include <fstream> //header for fstreaming of files

void form(int, int, int, int, int, int); //for form
void frame(int, int, int, int, int, int);//for frame



void main(void)
{
	char ans;
		do{
		clrscr();
		form(3,3,10,10, YELLOW,GREEN);
		gotoxy(18,4); cprintf("Girl Scouts of the Philippines Registration Form");
      frame(2,2,79,37, LIGHTMAGENTA,WHITE); //size and color of the frame
		frame(1,1,80,38,WHITE,LIGHTMAGENTA);

      textbackground (CYAN);
      gotoxy(2,2);cprintf("");
      textbackground (CYAN);
      gotoxy(2,3);cprintf("");
      textbackground (CYAN);
      gotoxy(2,4); cprintf("");
      textbackground (CYAN);
      gotoxy(2,5);cprintf("");
      textbackground (CYAN);
      gotoxy(2,6);cprintf("");
      textbackground (CYAN);
      gotoxy(2,7);cprintf("");

		ofstream input;
		string content2;
		input.open("sample.xls");
			if (input.good())
			{
         char last[60]; char first[60]; char middle[60];
         char age[3];
         char yrsec[15];
         char bday[8];


         textbackground (MAGENTA);
			gotoxy(4,6); cprintf("Last Name: "); cin.getline(last,60); //for enabling whitespaces
         							input<<"Last Name: "<<last;

         gotoxy(4,8); cprintf("First Name: "); cin.getline(first, 60);
         							input<<"First Name: "<<first;

         gotoxy(4,10); cprintf("Middle Name: "); cin>>middle;
         							input<<"Middle Name: "<<middle;

         gotoxy(4,12); cprintf("Age: ");cin>>age;
      								input<<"Age :"<<age;

			gotoxy(4,14); cprintf("Year-Section: "); cin>>yrsec;
         							input<<"Year-Section: "<<yrsec;

      	gotoxy(4,16); cprintf("Birthday [mm/dd/yy]: "); cin.getline(bday, 8);
         							input<<"Birthday: "<<bday;
         clrscr();
			}

gotoxy(4,10);cprintf("Do you wish to input more files? [y/n] "); cin>>ans;
gotoxy(40,18);cprintf("");
frame(2,2,79,37, LIGHTMAGENTA,WHITE); //size and color of the frame
frame(1,1,80,38,WHITE,LIGHTMAGENTA);
input.close();

		}while (ans=='y'||ans=='Y');

}



void form(int x1, int y1, int y2, int x2, int forecolor, int backcolor)

	{
	textcolor(forecolor); textbackground(backcolor);
	for(int k = y1; k <= y2; k++)
	for(int h = x1 ; h <= x2; h++)
	{gotoxy(h,k); cprintf("");}

	}

void frame(int x1, int y1, int x2, int y2, int color, int bgcolor)
{
	textcolor(color);
	textbackground(bgcolor);
	for(int x = x1+1; x < x2; x++)
		{
		gotoxy(x,y1); cprintf("Ä");
		gotoxy(x,y2); cprintf("Ä");

		}
	for (int y= y1+1; y < y2; y++)
		{
		gotoxy(x1,y); cprintf("³");
		gotoxy(x2,y); cprintf("³");
		}
	gotoxy(x1,y1); cprintf("Ú");
	gotoxy(x2,y1); cprintf("¿");
	gotoxy(x1,y2); cprintf("À");
	gotoxy(x2,y2); cprintf("À");
}
also, when you proceed to the next loop, after entering "y", there is no entry for last name, and proceeds right away to first name.
Topic archived. No new replies allowed.