Write to program to create a file. input user defined data entered from keyboard and write to the file. Read the contents of the file in reverse order and store to another file.
Roll a die from N faces M times and count how many times face X came out (N, M and X chosen by the user)
write a program to read the last word from a file and print to output screen.
Write 2 program to create a file. input user defined data entered from keyboard and write to the file. Read the contents of the file in reverse order and store to another file.
. Write a C++ program which takes electric units consumed and rate per unit as input
from user. Also take general sales tax (%), tv license fee and bank charges as input.
Calculate total payable amount for user and display on screen both Total amount
payable and amount without gst, bank Fee and tv fee.
Write a program to plot a graph of function f(x) = x
n + xn-1
. Your program should take a maximum
absolute value of x as well as a positive integer n as input. You will plot a graph for the range [0, x]. You
should label the y-axis according to the maximum value of x.
Sample Output: For x = 3 and n = 2, you should have the following output
12 *
10
08
06 *
04
02 *
00 *
0 1 2 3
A perfect number is an integer that is equal to the sum of its factors. For example, 6 is a perfect number
as 6 = 3+2+1. Write down a program that takes an integer x as an input and prints all perfect numbers
from 1 to x.
A cannon ball is thrown straight into the air with velocity
v0. Position of the cannon ball after t seconds is given by, s = vi t – (1/2) gt.You are required to confirm equation by a simulation. In simulation, you will consider how the ball moves in very short time interval Δt.In a short time interval, the velocity v is nearly constant, and we can compute distance the ball moves using Δs = vΔt. Δt is a constant double with value 0.01. Get updated position using s = s + v * Δt. Velocity changes constantly—in fact, it is reduced by the gravitational force. In a short time interval, Δv = –gΔt, you must keep the velocity updated as v = v - g * Δt; In next iteration, new velocity is used to update distance.You need to run simulation until cannon ball falls back to ground. Take initial velocity as input. Update position and velocity 100 times per second, but print out the position only every full second. Also, printout values from exact formula s = vi t – (1/2) gt2 for comparison. Lastly plot path.