Friday, 11 July 2014

A Program That Calculates Fee Collected From Class

Problem

Write a program that gets input of total number of students in a class and then asks for the fee collected per student. It displays total fee collected from the class.
Note: Problem forwarded to us by "Ali Aftab".

Input 3-Digit Number and Output Each Digit on Separate Line

Problem

The problem is to input a 3 digits number from the user. And then break that number into digits and show each digit on separate line. This problem should be solved using C++ (C Plus Plus) programming language.
Note: The problem was sent to me by my friend "Ali Aftab".

Monday, 10 March 2014

Chapter 1: Engineering Numerical Analysis


getline: Another Method of Taking Input in C Plus Plus

In previous lessons we have learn that the keyword cin is used to get input from the user. But I want to tell you something about cin keyword that is very important to know. The keyword cin separates the words or "group of characters differentiated by spaces". It only keeps the first group of characters (or first word) and ignores the rest of the characters coming after the space.

Wednesday, 5 February 2014

A Program that Finds Minimum Number using Loop

Problem:

Write a program that inputs the series of 20 numbers and displays the minimum value.

Solution:

Here is the code that gets input of 20 numbers and displays the minimum value using for loop.

A Code to Display Alphabets using For-Loop

Problem:

Write a program to display alphabets from A to Z using for-loop.

Solution:

Here is the code that displays alphabets from A to Z using for-loop:

A Program that Displays Sum of Series Using Do-while Loop

Problem:

Write a program that displays the sum of the following series using do-while loop:
1 + 1/4 + 1/8 + ... + 1/100

Solution:

Here is the code that solves the problem given above:

A Program That Shows Given Output using While-Loop

Problem:

Write a program to show the following format using while loop:
The output to be shown using while-loop
Show this format using while-loop

Solution:

Here is the code, that shows the given format as output, using while-loop:

A Program Using "While" Loop

Problem:

Write a program to display the following format using while loop:
The format to be printed using while-loop
Print this format using while-loop

Solution:

Here is the code that shows the given format using "while" loop: