This project has moved. For the latest updates, please go here.

a way to regulate the text entered by the user within the boundaries set by "\xdb"

Dec 3, 2016 at 2:04 PM
Hello everyone:

I been working on this program which is a patient report for a hospital but i have a problem:
i have set boundaries using the "\xdb" but when i let the user type the report in run time, the text exceeds the boundaries. so is there anyway how i can regulate the input string inside the boundaries.

Here is the program:

include<iostream.h>

include<conio.h>

include<stdlib.h>

include<string.h>

void main()
{
clrscr();
char name[10],doctname[10],disease[10],des[200];
int age,i;
//---------------------------------------------------------------------------
for (i=0;i<=40;i++)
  {
  gotoxy (10+i,2);
  cout <<"\xdb";
  gotoxy (10+i,6);
  cout <<"\xdb";
  gotoxy (10+i,24);
  cout <<"\xdb";
  }
  for (i=0;i<=22;i++)
  {
  gotoxy (10,2+i);
  cout <<"\xdb";
  gotoxy (50,2+i);
  cout <<"\xdb";
  }
  gotoxy(11,3);
  cout<<"pat Name: ";
  gotoxy(11,5);
  cout<<"Disease: ";
  gotoxy(32,3);
  cout<<"Age: ";
  gotoxy(32,5);
  cout<<"Doctor: ";
  gotoxy(12,7);
  cout<<"Patient Report: ";
  gotoxy(35,22);
  cout<<"Sign";
  gotoxy(40,22);
  cout<<"__________";
//---------------------------------------------------------------------------
gotoxy(20,3);
cin>>name;
gotoxy(20,5);
cin>>disease;
gotoxy(38,3);
cin>>age;
gotoxy(39,5);
cin>>doctname;
//----------------------------------------------------------------------------
gotoxy(11,8);
cin>>des; //for typing the report in run time




getch();
}