Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

Monday, 17 October 2016

How to create a C program without main function

              C PROGRAM WITHOUT MAIN FUNCTION

Hello friends... 
we always create a program in C and C++ programming language and the most important thing is that we create a main function in every program.We are also taught by the teachers that we can not create a C program without main function .As we know main is a user defined function so can we make a C program without main function?
Yes we can....


So in this post i will show you how to achieve this task.
here is the code...

#include<stdio.h>
#include<conio.h>
#define begin main
int begin()
{
              clrscr();
              printf("This program is without main function");
              getch();
              return 0;
}

This program will  compile and run successfully .

So this was all for this post we will come with new and interesting typical programmming in C that make a lot of fun.








Monday, 3 October 2016

how to create a 3d animation in C language

HOW TO CREATE A 3D ANIMATION IN C LANGUAGE

Hello friends we always want to do something new so that we can improve ourselves in every field of our lives.
Here i have created a program of 3d animation in C language .I have used turbo C++ compiler for this and also recommend you to use if you are running this program.Its ouput is pretty much cool and you can customize it your own so enjoy it....
Here is the code.....
ALSO SEE:TYPING GAME PROJECT IN C


#include<conio.h>
#include<stdio.h>
#include<graphics.h>
void happy();
int main()
   {
happy();
return 0;
}
void happy()
{
int x,y, gd = DETECT, gm;
     char arr[]="HAPPY TEACHER'S DAY 2016",arr1[]="They say that...'Experience is the best teacher'";
     int i;
     initgraph(&gd,&gm,"c:\\tc\\bgi");//used to initialised the graphics
     settextstyle(SCRIPT_FONT,HORIZ_DIR,3);//used to change the text style and size
    setcolor(4); // used to set the color of the output text
     outtextxy(50,170,arr1);  //used to print msg at the given position cursor
     outtextxy(50,190,"But for us...");
     outtextxy(50,210,"Having you as our teacher is the best experience!");
     settextstyle(TRIPLEX_FONT,HORIZ_DIR,1);
     setcolor(GREEN);
outtextxy(300,350,"Created By :: Shashi Kumar");
settextstyle(TRIPLEX_FONT,HORIZ_DIR,5);
     while(!kbhit())
{
     for(i=100;i<110;i++)
     {
outtextxy(50,i,arr);
setcolor(i);
delay(200); // pause the program
     }
}       getch();
     
system("cls");  // substitution for CLRSCR();
closegraph();
}
ALSO SEE::HOW TO CHANGE THE BACKGROUND COLOR OF TURBO C++ EDITOR'S BACKGROUND

Saturday, 10 September 2016

program to create an animated heart in C++ language




Today i am sharing the code for animated heart in c++

#include<conio.h>
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
#include<shashi.h> // header file is created by me which contains the definitions of delay,setcolot,gotoxy,and some others functions
using namespace std;
void heart()

{       int i,j,n=3;
    while(1)//for infinately use for the heart to be created.
    {            n=3;
                delay(500);
        setcolor(10);
        cout<<"\n\n\t";
        for(i=1;i<=n;i++)//loop for upper part
        {   setcolor(i+5);//IN Turbo C++ use "textcolor" instead of setcolor
                delay(500);  //Delay is used to delay the program execution

            for(int j=1;j<=(n-i);j++)//loop for space for upper part
                cout<<" ";

            for(j=1;j<=i+2;j++)//upper part  1st tomb pattern
               {cout<<"* ";
                setcolor(i+j);
               }

            for(j=1;j<=2*(n-i);j++)//upper part  2nd tomb pattern
                cout<<" ";
            for(j=1;j<=i+2;j++)
                {cout<<"* ";
                 setcolor(i+5);
                }
                cout<<"\n\t";
        }

        n=11;
        for(i=1;i<=n;i++)//loop for rest triangle
        {    delay(500);
            for(j=1;j<=2*i-j;j++)
               {    if(i==1)
                   cout<<" ";
                   if(i>1)
                    cout<<"  ";
               }

            for(j=1;j<=(n-i*2);j++)
               {cout<<"* ";
                setcolor(i);
               }

            cout<<"\n\t";
        }
                gotoxy(20,20);cout<<"::Created by shashi::";//gotoxy is used to set cursor position rowwise and columnwise
                delay(500);
                system("cls");//In Turbo C++ use clrscr() in place of system("cls")
    }//End of while loop

}
int main()
{
    heart();
    return 0;
}