Hey there. Here's the problem. My do-while statements are correct, the program is running but it does not loop/goes back to the first step when the condition's satisfied, neither does it exterminate when the condition is false. Here's the code (ignore the codes for frames and forms):
#include <iostream.h> //header files
#include <conio.h>
#include <cstring>
#include <stdlib>
#include <fstream> //header for fstreaming of files
gotoxy(4,18);cprintf("Do you wish to input more files? [y/n] ");
cin>>ans;
}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("Ä");
char ans[1];
should be a single character like this: char ans;
The first version specifies a null-terminated string which has space for nothing apart from the null terminator. Its use like this cin>>ans; will cause corruption of some other data, with unpredictable results, most likely a program crash.