2013年1月16日 星期三

C++(1)


第一章 Introduction to Computers and C++ Programming

A computer is a device capable of performing computations and making logical decisions at speeds millions of times faster than human beings can.

Input Unit
Output Unit
Memory Unit
Arithmetic and Logic Unit
General Processing Unit
Secondary Storage Unit

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
    int num1, num2;

    cout << “Enter two integers, and I will tell you\n”
           << “the relationships they satisfy:”;

    cin >> num1 >> num2;

    if(num1==num2)
        cout << num1 << “ is equal to “ << num2 << endl;

    if( num1 != num2 )
        cout << num1 << “ is not equal to “ << num2 << endl;

    return 0; //indicate that program ended successfully
}

沒有留言:

張貼留言