Thursday, 24 January 2013

1 create table gotoxy

// Program create on visual studio consol application.
// Assignment: create table by using "For Loop" and gotoxy funtion.
// university: Govt. College university.
// Department of computer science.
// submitted by: Muhammad Ateek.
// Roll number: 03-bscs-2011
// sysmester:  1st
// submitted to: Atifa Athar.


#include "stdafx.h"
#include <iostream>
#include<windows.h>
COORD coord={0,0}; // function to set the cursor point
         void gotoxy(int x,int y)
       {
             coord.X=x;
             coord.Y=y;
             SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
       }




using namespace std;
int main ()
{
   

cout << "create table by using For Loop and gotoxy funtion \n";
cout << "Govt. College University Lahore\n";
cout << "Roll# 03-bscs(Hon)\nMuhammad Ateek";

int a,b,x,y;  // variables
x=0;
y=0;



for(a=1;a<=5;a++)  //For Lop.
    {
        y=y+5;
    x=0;
gotoxy(x,y);   // gotoxy function.

    for(b=1;b<=5;b++)  //2nd For loop
        {

         x=x+5;

        gotoxy(x,y);  // goto function to show spaces between numbers of table.
        cout<<a*b;
        }
    }

cin.get(); // stop the screen to display.
return 0;
}


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Enterprise Project Management