Tag: C++

Exercise # 04 Decision Making Statements in C++

Q: Develop a C++ program which will compute the power dissipation of a resistor, when the user inputs current value and the resistance. Program warns the user if power dissipation is above 1 watt. The power dissipation is measured by P=I2R. Answer: #include <iostream.h> #include <conio.h> void main() { float varP, varI, varR; cout<<“Enter the […]

Posted in: C++ Exercises

Exercise # 03 Decision Making Statements in C++

Q: Write a program which gives the following output Enter age>> And prints the following: If Age is greater than 45 then prints the message “You are old stay at home and wait for call” If Age is greater than 30 and less than 45 then prints “Hey! man enjoy your life with your kids” […]

Posted in: C++ Exercises

Exercise # 02 Decision Making Statements in C++

Q: Write a program which gives the following output Enter age>> And prints the following: If Age is greater than 45 then prints the message “You are old stay at home and wait for call” If Age is greater than 30 and less than 45 then prints “Hey! man enjoy your life with your kids” […]

Posted in: C++ Exercises

Exercise # 01 Decision Making Statements in C++

Q: Write a program that determines the year entered by user is leap year or not? Answer: #include <iostream.h> #include <conio.h> void main() { int leapyear; cout<<“Enter the year: “; cin>>leapyear; if(leapyear%4==0) cout<<leapyear<<” is leap year”; else cout<<leapyear<<” is not leap year”; getch(); }

Posted in: C++ Exercises

Exercise Program # 04 Operators in C++

Q: Develop a program that will convert the temperature from degree Celsius to degree Fahrenheit. User input the temperature in Celsius. The relation is F=5/9*C+32? Answer: #include <iostream.h> #include <conio.h> void main() { float Ctemp, Ftemp; cout<<“Enter the temperature in Celsius: “; cin>>Ctemp; Ftemp=(9/5)*Ctemp+32; cout<<endl<<“The temperature in Fahrenheit is: “<<Ftemp; getch(); }

Posted in: C++ Exercises

Exercise Program # 03 Operators in C++

Q:¬†Write a program that calculates the memory size of variable of different data type? Answer: #include <iostream.h> #include <conio.h> void main() { char a; short b; int c; long d; float e; double f; long double g; cout<<“Size of a: “<<sizeof(a)<<” byte”<<endl; cout<<“Size of b: “<<sizeof(b)<<” bytes”<<endl; cout<<“Size of c: “<<sizeof(c)<<” bytes”<<endl; cout<<“Size of d: […]

Posted in: C++ Exercises

Exercise Program # 02 Operators in C++

Q: Write a program that will solve for the power dissipation of a resistor when the voltage across the resistor and the current in the resistor are known. The relationship for the power dissipation is: P=I^2*R? Answer: #include <iostream.h> #include <conio.h> void main() { float V, I, R, P; cout<<“Enter the voltage across the resistor: […]

Posted in: C++ Exercises

Exercise Program # 01 Operators in C++

Q : Write a program that will compute the area of a circle. The user must enter the radius of the circle. Use the following formula for area A=3.14*R^2? Answer : #include <iostream.h> #include <conio.h> void main() { const float PI=3.14; int radius; float area; cout<<“Enter the radius of the circle: “; cin>>radius; area=PI*(radius*radius); cout<<“The […]

Posted in: C++ Exercises
Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .