Round up a Decimal number in c++..
example Note = 3.5 is as 4
3.3 is as 3
Answer Posted / vimala
void main()
{
float a,c;int b,d;
cout<<"ENTER ANY FLOAT VALUE:";
cin>>a;
b=a;c=(a-b);
if(c>=.5)
d=b+1;
else
d=b;
cout<<"AFTER ROUND UP THE DECIMAL NO IS:"<<d;
getch()
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Why do we use class in oops?
class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box
Why is object oriented programming so hard?
What is inheritance and how many types of inheritance?
What does <> mean pseudocode?
What is the oops and benefits of oops programming?
Why interface is used?
What is oops in simple words?
What causes polymorphism?
Is abstract thinking intelligence?
Which language is pure oop?
Why multiple inheritance is not possible?
What is difference between inheritance and polymorphism?
What is overloading in oop?