Gotoxy In CPP

A simple CPP program to print the form by using gotoxy and it will calculate total, percentage, and grade.

-You can set the coordinate by using gotoxy() function.

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();

int rollno;
char fname[10];
char name[10];
int a;
int b;
int c;
int d;
int e;
int tot;
gotoxy(25,1);
cout << "Sai Shree International Academy" << endl;
gotoxy(1,2);
cout << "--------------------------------------------------------------------------------" ;

gotoxy(1,3);
cout << "ROLL NO-" ;

gotoxy(9,3);
cin>>rollno;

gotoxy(60,3);
cout << "NAME-" ;

gotoxy(65,3);
cin>>name;
gotoxy(1,4);
cout << "FNAME-" ;

gotoxy(7,4);
cin>>fname;

gotoxy(1,5);
cout << "--------------------------------------------------------------------------------" ;
gotoxy(1,6);
cout << "SNO" ;
gotoxy(1,8);
cout << "1" ;
gotoxy(1,9);
cout << "2" ;
gotoxy(1,10);
cout << "3" ;
gotoxy(1,11);
cout << "4" ;
gotoxy(1,12);
cout << "5" ;


gotoxy(20,6);
cout << "SUBJECTS" ;

gotoxy(20,8);
cout << "HINDI" ;

gotoxy(20,9);
cout << "ENGLISH" ;

gotoxy(20,10);
cout << "PHYSICS" ;

gotoxy(20,11);
cout << "CHEMISTRY" ;

gotoxy(20,12);
cout << "MATHS" ;

gotoxy(1,13);
cout << "--------------------------------------------------------------------------------" ;

gotoxy(45,6);
cout << "MAX M" ;

gotoxy(45,8);
cout<<"100";
gotoxy(45,9);
cout<<"100";
gotoxy(45,10);
cout<<"100";
gotoxy(45,11);
cout<<"100";
gotoxy(45,12);
cout<<"100";


gotoxy(65,6);
cout<<"OBTAIN M";


gotoxy(72,8);
cin>>a;

if(a<=33)
{
gotoxy(74,8);
cout<<"*"<<endl; }="" gotoxy(72,9);="" cin="">>b;

gotoxy(72,10);
cin>>c;

gotoxy(72,11);
cin>>d;

gotoxy(72,12);
cin>>e;
gotoxy(1,7);
cout << "--------------------------------------------------------------------------------" ;

gotoxy(25,15);
cout << "TOTAL=" ;


tot=a+b+c+d+e;
gotoxy(31,15);
cout << tot << endl;

gotoxy(25,16);
cout << "PER=" ;

int per=tot/5;
gotoxy(29,16);
cout << per << "%" << endl;
gotoxy(25,17);
cout << "GRADE=" ;

if(per>=85)
{
gotoxy(32,17);
cout << "A+" << endl;
}
else
{
gotoxy(32,17);
cout << "your performance was not well" << endl;
}

getch();
}

 

Leave a Reply