basic programming for kid by C++ Language

First need to remember the basic structure of C++ Language
Simple Structure C++
=================================

  /* The first example program */  /* <-- The point at which the reminder that we write something. Days to read and understand. */
     # include  <stdio.h>   /*<-- Choose a book that is relevant to what we will have to write this program. {Library File for using in c++}*/
     # include  <conio.h>
    /* Begin the Body of the program --> */
    main ()
    {
     float p,v,i;  /* <-- A variable before you start running all the time. (Declarations) */
     char ch;
     clrscr ();   /*<-- A standard function or command "clrscr ();" for clearing the screen of the program.*/
     v = 220.0;   /*<-- The default configuration parameters in the process below. (Assignment) */

     /*Output message on screen -->*/
     printf("Enter Current : ");
     scanf("%f",&i); /* <-- Are getting value from the key board and store it in variable*/
     printf("\n"); /*<--It were to start a new line.*/
     p= v*i; /*<-- 
Part of the calculation.*/

     /*(Begin Output result on screen)*/
     printf("The voltage = %f volts\n",v);
     printf("The current = %f amperes\n",i);
     printf("The power = %f watts\n",p);
     printf("\n\n   P= V x I \n");
     printf("%11.2f = %5.2f x %5.2f\n",p,v,i);
     getch(); /* <-- Function call */
    }   /*End main()*/
   
note: you can try understand to write :D



แสดงความคิดเห็น

ใหม่กว่า เก่ากว่า