Thursday, July 17, 2008

Trying operator of equation and relationship operator

Guide:

  1. Use steps program II, but using Project_name which differing, for example Third Program

  2. Change block program function play with following:

    int num1; /* first number to be read from user */
    int num2; /* second number to be read from user */

    printf( "Enter two integers, and I will tell you\n" );
    printf( "the relationships they satisfy: " );

    scanf( "%d%d", &num1, &num2 ); /* read two integers */


    if ( num1 == num2 ) {
    printf( "%d is equal to %d\n", num1, num2 );
    } /* end if */

    if ( num1 != num2 ) {
    printf( "%d is not equal to %d\n", num1, num2 );
    } /* end if */

    if ( num1 < num2 ) {
    printf( "%d is less than %d\n", num1, num2 );
    } /* end if */

    if ( num1 > num2 ) {
    printf( "%d is greater than %d\n", num1, num2 );
    } /* end if */

    if ( num1 <= num2 ) {
    printf( "%d is less than or equal to %d\n", num1, num2 );
    } /* end if */

    if ( num1 >= num2 ) {
    printf( "%d is greater than or equal to %d\n", num1, num2 );
    } /* end if */

    return 0; /* indicate that program ended successfully */

Reading the two integer and present its quantifying result

Guide:
  1. Use steps of making template program as in for step to five , but using Project_Name which differing, for example SecondProgram

  2. Change block program function play with following:
    int integer1; /* first number to be input by user */
    int integer2; /* second number to be input by user */
    int sum; /* variable in which sum will be stored */

    printf( "Enter first integer\n" ); /* prompt */
    scanf( "%d", &integer1 ); /* read an integer */

    printf( "Enter second integer\n" ); /* prompt */
    scanf( "%d", &integer2 ); /* read an integer */

    sum = integer1 + integer2; /* assign total to sum */

    printf( "Sum is %d\n", sum ); /* print sum */

    return 0; /* indicate that program ended successfully */

  3. Do step 6 and 7 template of such as program I.

Presenting ' Hello, World!' at screen

Steps make simple template program:

  1. Run software Microsoft Visual C++ 6.0 from Microsoft Visual Studio 6.0 (if need have recourse assistant)
  2. Select File menu -> New
  3. At dialogued by box select tab Projects, hereinafter:
    • Click Win 32 Console Application
    • Write name project, take example FirstProgram at stuffing Project_Name:
    • Determine directory of this place project be at Location: (possibility of filled with your directory home)
    • ClickOK
  4. Will emerge dialogue of box Win 32 Console Application:
    • Select radiobutton A “Hello, World!” application
    • Click Finish
    • Click OK
  5. At small window (generally on the left):
    • Click tab File View
    • Click sign + at FirstProgram files
    • Click sign + at Sourcefiles
    • DoubleClick at FirstProgram.cpp
  6. Select menu Build à Build Firstprogram.Exe or depress F7 at keyboard
  7. Select icon of exclamation mark (!), will emerge window console…