Wednesday 10 August 2011

HANGING OUT THE BASICS OF C++

BASICS OF C++

I have made a simple program which deals with the basics of C++ programming. It includes all the simple calculations and forms you can use in C++ . So please comment And share knowledge and share your concern in our Share tab.

 



STEPS TO START THE BELOW PROGRAM:

  • Copy the program code.
  • Paste it in a notepad file.
  • Save it as Atul.cpp (remember to apply .cpp extinction )
  • The file Atul.cpp should be in the Tc --->Bin folder which is present in the C drive by default.
  • Then Run your Tc.exe (C++) file. 
  • Then Go to file.
  • Then go to the sub tab open and type Atul.cpp on the name panel.
  • Then a program similar to the below one will appear on the blue screen of C++.
  • Press Ctrl+F9 button to start the program. 

If any doubts in the steps please let me know in the share us tab.

The Program is :

//password 'ATUL'
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<graphics.h>

 #include<string.h>
#include<stdlib.h>
#include<math.h>

void main(int)
{
 textcolor(RED);
 clrscr();
 textcolor(GREEN);
 cprintf("\n                         ~WELCOME TO TEXPROGRAM~");
 textcolor(BLUE);
 cprintf("-by ATUL\n");
 int b,c,f,g,h,i,j,q,ra,s,t,u,v,w,x,y,z,za,zb,zc,zf,zg,zh,smallest,largest;
 float k,l,m,n,o,p;
 char d[40],e[40],zd,ze,a[20],zi;
 cout<<"\n          INPUT THE PASSWORD WRITTEN IN THE README FILE OF THIS PROGRAM\n\t\t\t\t\t";
 cin>>a;
 if ((strcmp(a,"ATUL")==0)||(strcmp(a,"atul")==0)||(strcmp(a,"Atul")==0))
 { cout<<"\n                THE PASSWORD IS CORRECT WELCOME TO THIS PROGRAM\n\n";
   textcolor(BLUE+BLINK);
   cprintf("\n                            PRESS ANY KEY TO CONTINUE\n");
   getch();
   textcolor(YELLOW);
   clrscr();
   cout<<"\nENTER YOUR FIRST NAME\t";
   cin>>d;
   cout<<"\nENTER YOUR SURNAME\t";
   cin>>e;
   textcolor(CYAN);
   clrscr();
   cout<<"\n                        HELLO!! "<<d<<" "<<e<<"\n";
   cout<<"\nOK NOW TELL ME YOUR AGE\n";
   cin>>b;
   c=2010-b;
   cout<<"\nI THINK YOU WERE BORN IN "<<c<<"\n";
   cout<<"\nOK LET's DO ONE THING, TYPE A 4 DIGITS NUMBER\n";
   cin>>f;

   g=f/1000;
   h=(f%1000)/100;
   i=(f%100)/10;
   j=f%10;
   cout<<"\nTHE REVERSE OF THE NUMBER YOU ENTERED IS "<<j<<i<<h<<g<<"\n";
   getch();
   textcolor(WHITE);
   clrscr();
   cout<<"\nNOW WANT SOME CALCULATIONS , OK LETS CONTINUE\n";
   cout<<"\n            TYPE FIRST NUMBER\t";
   cin>>k;
   cout<<"\n            TYPE SECOND NUMBER\t";
   cin>>l;
   m=k+l;
   n=k*l;
   o=k-l;
   p=k/l;
   cout<<"\nPRESS ENTER TO VIEW ALL THE FOUR OPERATIONS BY "<<k<<" and "<<l<<"\n";
   getch();
   cout<<"\n                  ADDITION="<<m<<"\n";
   cout<<"\n                  MULTIPLICATION="<<n<<"\n";
   cout<<"\n                  SUBTRACTION="<<o<<"\n";
   cout<<"\n                  DIVISION="<<p<<"\n";
   cout<<"\nOK NOW TYPE A NUMBER TO GET IT's SQUARE ";
   cin>>q;
   ra=q*q;
   cout<<"\nTHE SQUARE OF "<<q<<" is "<<ra<<"\n";
   getch();
   textcolor(BLUE+RED);
   clrscr();
   cout<<"\nNOW TYPE A NUMBER TO FORM ITS TABLEx10 ";
   cin>>s;
   t=s*1;
   u=s*2;
   v=s*3;
   w=s*4;
   x=s*5;
   y=s*6;
   z=s*7;
   za=s*8;
   zb=s*9;
   zc=s*10;
   cout<<"\nTHE TABLE FORMED BY "<<s<<" IS\n";
   cout<<"\n"<<s<<" x1= "<<t;
   cout<<"\n"<<s<<" x2= "<<u;
   cout<<"\n"<<s<<" x3= "<<v;
   cout<<"\n"<<s<<" x4= "<<w;
   cout<<"\n"<<s<<" x5= "<<x;
   cout<<"\n"<<s<<" x6= "<<y;
   cout<<"\n"<<s<<" x7= "<<z;
   cout<<"\n"<<s<<" x8= "<<za;
   cout<<"\n"<<s<<" x9= "<<zb;
   cout<<"\n"<<s<<" x10= "<<zc;
   textcolor(YELLOW);
   getch();
   clrscr();
   cout<<"ENTER 3 INTERERS :";
   cin>>zf>>zg>>zh;
   smallest=zf;
   if(zg<smallest)
   smallest=zg;
   if(zh<smallest)
   smallest=zh;
   largest=zf;
   if(zg>largest)
   largest=zg;
   if(zh>largest)
   largest=zh;
   cout<<"\nThe smallest integer out of which you typed is "<<smallest;
   cout<<"\nTHE largest Integer out of which you typed is "<<largest;
   getch();
   clrscr();
   int aa,ab,ac;
    cout<<"\n\nEnter a number\n\n";
    cin>>aa;
    ab=aa*aa;
    {
    ac = sqrt(aa);
    }
    getch();
    clrscr();
    cout<<"THE SQUARE OF THE NUMBER IS "<<ab<<" \n\n THE SUQUARE ROOT OF THE NUMBER IS "<<ac;
   textcolor(YELLOW);
   cout<<"\nNOW WELCOME TO OUR LAST ROUND, THE QUIZZING ROUND\n";
   cout<<"\n\n\n\nPRESS ENTER TO CONTINUE\n\n";
   getch();
   clrscr();
   cout<<"\n1) WHAT IS C++?\n\n\n\n a) PROGRAMING LANGUAGE\n\n\n\n b) MOVIE MAKER\n\n\n\n c) ANIMATION DESIGNER\n\n\n\n d) none of these\n\n\n\n";
   cin>>zd;
   switch(zd)
   {
      case 'a':cout<<"\n\n\nYOU ARE CORRECT\n\n\n";
      getch();
   clrscr();
   cout<<"\n2) WHICH SITES ANMONGS THESE CAN BE USED FOR MAKING A BLOG?\n\n\n a) TWITTER\n\n\n\n b) FACEBOOK\n\n\n\n\n c) WORDPRESS\n\n\n\n d) BLOGGERS\n\n\n\n";
   cin>>ze;
   switch(ze)
   {
    case 'c':
    case 'd':cout<<"\nYOU ARE CORRECT\n";
     getch();
     clrscr();
   cout<<"\n3) Who was the founder of dell?\n\n\n\n a)Street Dell\n\n\n\n b)Michele Dell\n\n\n\n c)Robert Dell\n\n\n\n d)Charls Dell\n\n";
   cin>>zi;
   switch(zi)
   {
    case 'b':cout<<"\n\nThis Option Is Correct\n\n";
    getch();
    clrscr();
    int aa,ab,ac;

     int ba,bb,bc;
     cout<<"\n\n\n4) Who was the founder of Facebook\n\n a) LARRY PAGE\n\n b) SERGERY M. BRINE\n\n c) THOMAS CUTRTZ\n\n d) Mark Zuckerberg";
     cin>>ba;
     switch(ba)
     {
    case 'd':cout<<"\n\n\n\nRIGHT Answer\n\n\n";
    break;
    case 'a':
    case 'b':
    case 'c':cout<<"\n\n\n Wong !! GO TO HELL \n\n";
    break;
    default:cout<<"\n\n\nINVALID OPTION\n\n";

     }
    break;
    case 'c':
    case 'd':
    case 'a':cout<<"\n\nYOU LOST PRESS ENTER TO CONTINUE\n\n";
    break;
    default:cout<<"\n\nInvalid Option\n\n";
    }
    break;
    case 'a':
    case 'b':cout<<"\nYOU LOST PRESS ENTER TO CONTINUE\n";
    break;
    default:cout<<"\nINVALID OPTION\n";
     }
      break;
      case 'b':
      case 'c':
      case 'd':cout<<"\n\n\nYOU LOST PRESS ENTER TO CONTINUE\n\n\n";
      break;
     default:cout<<"\nINVALID OPTION\n\n\n";

}

    getch();

   clrscr();
   textcolor(RED+GREEN+BLINK);
   cprintf("\n                                                  THANKS FOR VISITING                        \n");
   cout<<"\n           a program presented by ATUL of class X-B of CAMBRIDGE SCHOOL\n";
   textcolor(BLUE+CYAN+BLINK);
   cprintf("\n\n\n\n                         PRESS 2 TIMES ENTER TO LEAVE\n\n\n\n\n");
   getch();

 }
 else
 { cout<<"\n              SORRY DUDE THE PASSWORD WAS NOT CORRECT GO AWAY SHIT!!!\n";
   getch();
   cout<<"\n                  THIS PROGRAM IS NOT APPLICABLE TO SUCH USERS\n";
 textcolor(YELLOW+BLINK);
 cprintf("\n                                 PREESS ANY KEY TO EXIT!!");
 }

 getch();
 }

//This program ends here .


-by Atul



2 comments:

back to top