Number to English Words
Write a program to convert a non-negative integer
The input will be a single line containing an integer
The output should be a single line containing the representation of the English words of number
For example, if the given number is 123, your code should print the English words representation, which is
One Hundred Twenty Three
Sample Input 1
123
Sample Output 1
One Hundred Twenty Three
Sample Input 2
10005
Sample Output 2
Ten Thousand Five
Sample Input 3
1234567891
Sample Output 3
One Billion Two Hundred Thirty Four Million Five Hundred Sixty Seven Thousand Eight Hundred Ninety One
The post office needs a program that reads in postal address data and then displays the data in a neat format.
declare four string variable name ,addr1, addr2 and postalCode.
First ,the main function of the program must input the data by means of a function called inputData
critically explain why you would consider arrays over normal data
types AP[5 marks]
b. from your explanation in “a” above, define and initialize an array called
BongoBar of type string and having 4 elements. CR[5 marks]
c. embed your array in “b” above in a full c++ program and display each
of the initialized data when your program executes. CR [5 marks]
d. critically explain what will happen if an amateur programmer decides to
called BongoBar[5] in the main function in your program in “c” above.
Create a template class for a Matrix(2d array) and write the following functions in it.
1. Print the left diagonal
2. Print the right diagonal
3. Print specified row
4. Print specified column
5. Print overall matrix.
Write a function partition (), that take the first element of the array x and put x in a position such
that all smaller elements (smaller than x) are before x, and put all greater elements (greater than
x) after x.
Define a class template named Alice that takes a single type parameter. Make Alice a friend of all instances of a template class named Friendly. Give Alice member functions that demonstrate its friendship.
Q1: Write a function template that takes a single type parameter (T) and accepts four function arguments: an array of T, a start index, a stop index (inclusive), and an optional initial value. The function returns the sum of all the array elements in the specified range and the initial value. Use the default constructor of T for the default initial value.
Submitted date:- Wed, June 2
Problem1: write down algorithm to calculate even numbers between 0 and 99 using pseudocode and flowchart.
Problem2: Design an algorithm which gets a natural value, n,as its input and calculates odd numbers equal or less than n using pseudocode and flowchart.
Problem3: Design an algorithm which generates even numbers between 1000 and 2000 and then prints them in the standard output. It should also print total sum.
Problem4: Design an algorithm with a natural number, n, as its input which calculates the following formula and writes the result in the standard output:
S = ½ + ¼ + … +1/n.
Problem 5: Find the area of a Circle of radius r using pseudocode and flowchart.
Problem 6: Flowchart for the problem of printing odd numbers less than a given number. It should also calculate their sum and count.
Problem7: Flowchart for the calculate the average from 25 exam scores.
1.Roll a dice 100 times and store the results in an array.
2.Roll a dice 100 times again and store the results in a different array.
3. The sums of the faces in each time are stored in another array.
4. Show the frequencies of the sum array on the screen.