Previous lesson displays static information. In this lesson we are going to use the dynamic display of information. #include <iostream> using namespace std; int main(){ //we declare data types here. string name; //fist we need to display the Instruction for the user."Enter your name: cout<<"Enter your name: //we call the "name" variable to get the user input. we use "cin" to get the user input cin>>name; //we call again our variable name to display what the user input. cout<<"Your name is: "<<name; //try it and try to complete the personal information. add the following variables //age, gender, address, email, mobile }
Hello!
I am trying to find how many jelly beans can fit in a jar. so I made some variables.
double height, diameter, beanLength, beanDiameter, glassThickness, radius, newRadius;
double volumeOfJar, airCubicInches, trueVolume, jellyBeanVolume;
as show here. But I need to initialize them. so I tried this
int height;
int diameter;
int beanLength; beanLength = 0.625;
int beanDiameter; beanDiameter = 0.25;
int glassThickness;
int radius;
int newRadius;
int volumeOfJar;
int airCubicInches;
int trueVolume;
int jellyBeanVolume;
But my program does not like that. How do I fix the varibles to be initialized?
diameter of a cycle wheel is D. Given that, the cycle travels at an average speed of X km/h,
find the number of revolutions made by the wheel per minute, giving your answer to the nearest whole
number (assume PI = 3.142). Write a C++ function to calculate revolutions per minute.
The diameter of a cycle wheel is D. Given that, the cycle travels at an average speed of X km/h,
find the number of revolutions made by the wheel per minute, giving your answer to the nearest whole
number (assume PI = 3.142). Write a C++ function to calculate revolutions per minute.
Assume a file named
Random.txt
exists, and contains a list of random numbers. Write a program that opens the file, reads all the numbers from the file, and calculates the following:
The program should display the number of numbers found in the file, the sum of the numbers, and the average of the numbers.
Output Labels:
Print each of the above quantities on a line by itself, preceded by the following (respective) strings: "
Number of numbers:
", "
Sum of the numbers:
", and "
Average of the numbers:
".
Sample Run
Number of numbers: 20
Sum of the numbers: 210
Average of the numbers: 10.5
there are 3 member functions.1st one to set value for person discount,distance.second one to display personcount,distance and fair .3rd function to caliculate the fair with assumption that fair for 1 person is 300rupees if distance>=1200km and 200 rs for<500kmand for in between distance it is 350 rupees write c++pgm