Click here to load reader

C++ laboratory exercise

  • View
    222

  • Download
    7

Embed Size (px)

DESCRIPTION

An exercise from UMT. Feel free to check it out~ :D

Text of C++ laboratory exercise

LABORATORY EXERCISESC++ PROGRAMMINGMT2044

LAB 1

NAMA: BEK E XUANUK: UK33537TARIKH: 12-10-2014

Program 3-9

// This program uses a type cast to avoid integer division.

#include "stdafx.h"#include using namespace std;

int main (){int books; // Number of books to readint months; // Number of months spent readingdouble perMonth; // Average number of books per month

cout > books;cout > months;perMonth = static_cast(books) / months;cout