-->

PROGRAM TO UNDERSTAND WINDOW() FUNCTION.

USING TURBOC++
-----------------------------------------------------------------------------------------
//understanding function of window() function.
#include<stdio.h>
#include<conio.h>// contains textcolor() and text background() and window().
void main()
{
clrscr();
window(10,10,40,11);     //generates window of given size
textcolor(BLUE); //sets textcolor blue
textbackground(BLACK); //Sets background black
cprintf("first line...........\n");
cprintf("second");
//sends formatted output to the text window on the screen
  //Does not work with printf.
getch();
}

/*second part prints line from that location where
first part is finished
*/

Program understand textcolor() and textbackground() function

using turboc++
------------------------------------------------------------------------------
//understanding textcolor in graphics
#include<stdio.h>
#include<conio.h>// contains textcolor() and text background().
void main()
{
clrscr();
textbackground(RED);  //Sets background red
textcolor(GREEN);    //sets textcolor green
cprintf("first line...........\n");
textcolor(GREEN);
textbackground(BLUE);
cprintf("This is a test\n");//sends formatted output to the text window on the screen
  //Does not work with printf.
getch();
}

/*second part prints line from that location where
first part is finished
*/
..............................................................................

program to understand fclose() with stdout

using codeblocks
---------------------------------------------------------------------------------------------------------
//understanding fclose() in the sense of stdout.
#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Hello world!\n");       //prints hello world
    fclose(stdout);                 // closes the data to be written to device
    printf("goodbye");               //does not print good bye.
    return 0;
}

------------------------------------------------------------------------------------
using turboc++
--------------------------------------------------------------------------------
//understanding fclose() in the sense of stdout.
#include <stdio.h>
#include <conio.h>

int main()
{
    printf("Hello world!\n");       //prints hello world
    fclose(stdout);                 // closes the data to be written to device
    printf("goodbye");               //does not print good bye.
    getch();
    return 0;
}

other programs

program to generate random numbers

using codeblocks
---------------------------------------------------------------------------------------------
//progrm to generate random numbers
#include <stdio.h>
#include <stdlib.h>  //contains rand() function
int main()
{
    int k,number;
    printf("how many u want=\n");
    scanf("%d",&number);
    printf("some randomly generated numbers are given below.\n");
    for(k=0;k<=number;k++)
    {
        printf("%7d\t",rand());//prints randomly generated numbers
    }
    return 0;
}
----------------------------------------------------------------------------------------------
using turboc++
--------------------------------------------------------------------------------------------------------
//progrm to generate random numbers
#include <stdio.h>
#include <stdlib.h>  //contains rand() function
#include<conio.h>
int main()
{
    int k,number;
    printf("how many u want=\n");
    scanf("%d",&number);
    printf("some randomly generated numbers are given below.\n");
    for(k=0;k<=number;k++)
    {
        printf("%7d\t",rand());//prints randomly generated numbers
    }
    getch();
    return 0;
}

enum data type with value

using codeblocks
-------------------------------------------------------------------------------------------------------
//enum simple program
#include <stdio.h>
#include <stdlib.h>
enum computer{samsung=1,LG,apple,hp,acer=5}; // list of values of enum. value location starts from 1.
enum computer find;                         //variable for object "computer"

int main()
{

   for(find=samsung;find<=acer;find++)// find variable runs from samsung to acer. The value runs from 1 to 5.

   {
       printf("location of =%d\n",find);// display that. the value increases itself.
   }
    return 0;
}

//or
/*
//enum simple program
#include <stdio.h>
#include <stdlib.h>

int main()
{
enum computer{samsung=1,LG,apple,hp,acer=5}; // list of values of enum. value location starts from 1.
enum computer find;                         //variable for object "computer"

    for(find=samsung;find<=acer;find++)// find variable runs from samsung to acer. The value runs from 1 to 5.

   {
       printf("location =%d\n",find);// display that. the value increases itself.
   }
    return 0;
}
*/
----------------------------------------------------------------------------------------------------
using turboc++
------------------------------------------------------------------------------------------------------------

//enum simple program
#include <stdio.h>
#include <stdlib.h>
enum computer{samsung=1,LG,apple,hp,acer=5}; // list of values of enum. value location starts from 1.
enum computer find;                         //variable for object "computer"

int main()
{

   for(find=samsung;find<=acer;find++)// find variable runs from samsung to acer. The value runs from 1 to 5.

   {
       printf("location of =%d\n",find);// display that. the value increases itself.
   }
    return 0;
}

//or
/*
//enum simple program
#include <stdio.h>
#include <stdlib.h>

int main()
{
enum computer{samsung=1,LG,apple,hp,acer=5}; // list of values of enum. value location starts from 1.
enum computer find;                         //variable for object "computer"

    for(find=samsung;find<=acer;find++)// find variable runs from samsung to acer. The value runs from 1 to 5.

   {
       printf("location =%d\n",find);// display that. the value increases itself.
   }
    return 0;
}
*/

program to use loop in enum data type

using codeblocks
----------------------------------------------------------------------------------------------
//enum simple program
#include <stdio.h>
#include <stdlib.h>
enum computer{samsung,LG,apple,hp,acer}; // list of values of enum. value location starts from 0.
enum computer find;                    //variable for computer

int main()
{
    find=acer;                          // assigning position of value acer in set
   for(find=samsung;find<=acer;find++)// find variable runs from samsung to acer. The value runs from 0 to 4.

   {
       printf("location of =%d\n",find);// display that
   }
    return 0;
}

//or
/*
//enum simple program
#include <stdio.h>
#include <stdlib.h>

int main()
{
enum computer{samsung,LG,apple,hp,acer}; // list of values of enum
enum computer find;                    //variable for computer

    for(find=samsung;find<=acer;find++)// find variable runs from samsung to acer. The value runs from 0 to 4.

   {
       printf("location =%d\n",find);// display that
   }
    return 0;
}
*/
//note:- we can also put set of value outside and enum variable inside.
// we can set value inside of set. Then,the other values takes values in increasing order.
------------------------------------------------------------------------------
using turboc++
--------------------------------------------------------------------------------------------
//enum simple program
#include <stdio.h>
#include <stdlib.h>
enum computer{samsung,LG,apple,hp,acer}; // list of values of enum. value location starts from 0.
enum computer find;                    //variable for computer

int main()
{
    find=acer;                          // assigning position of value acer in set
   for(find=samsung;find<=acer;find++)// find variable runs from samsung to acer. The value runs from 0 to 4.

   {
       printf("location of =%d\n",find);// display that
   }
    return 0;
}

//or
/*
//enum simple program
#include <stdio.h>
#include <stdlib.h>

int main()
{
enum computer{samsung,LG,apple,hp,acer}; // list of values of enum
enum computer find;                    //variable for computer

    for(find=samsung;find<=acer;find++)// find variable runs from samsung to acer. The value runs from 0 to 4.

   {
       printf("location =%d\n",find);// display that
   }
    return 0;
}
*/
//note:- we can also put set of value outside and enum variable inside.
// we can set value inside of set. Then,the other values takes values in increasing order.