9/18/2017

BCS1013 Lab 21 Sept 2017


1. Design an algorithm and write a C++ program  that prompts the user to input a number. The program should then output the number and a message saying whether the number is positive, negative, or zero.


2. Design an algorithm and write a C++ program  that prompts the user to input two numbers. The program should then output the numbers in ascending order.


3. Design an algorithm and write a C++ program  that prompts the user to input three numbers. The program should then output the numbers in ascending order.

4. Run the following program using several input such as 163, 200, 35.\

#include
#include
#include

using namespace std;

int main(int argc, char *argv[])
{
    int  RM, RM100 , RM50, RM10 , RM20, RM5, RM1 ,Baki ,Baki1, Baki2, Baki3;
    cout << "RM ";
    cin >> RM;
    RM100 = RM/100;
    Baki = RM%100;
    RM50 = Baki/50;
    Baki1 = Baki%50;
    RM20 = Baki1/20;
    Baki2 = Baki1%20;
    RM10 = Baki2/10;
    Baki3 = Baki2%10;
    RM5 = Baki3/5;
    RM1 = Baki3%5;
   
    cout << "Amount of RM100: " << RM100 << endl;
    cout << "Amount of RM50: " << RM50 << endl;
    cout << "Amount of RM20: " << RM20 <    cout << "Amount of RM10: " << RM10 << endl;
    cout << "Amount of RM5: " << RM5 << endl;
    cout << "Amount of RM1: " << RM1 << endl;
   
    system("PAUSE");
    return EXIT_SUCCESS;
}
 

No comments:

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...