Round up a Decimal number in c++..

example Note = 3.5 is as 4
3.3 is as 3

Answer Posted / pawarp

#include <iostream>
#include <cmath>
int main()
{
   float a;
   cout<<"Enter any float value to round up"<<endl;
   cin>>a;
   cout << round(a)<<endl;
   
   return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the main feature of oop?

619


Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

630


can inline function declare in private part of class?

3658


Get me a number puzzle game-program

1694


what is different between oops and c++

2001






What is multilevel inheritance?

727


What is the difference between inheritance and polymorphism?

591


write string class as your own class in java without using any built-in function

1976


What is polymorphism in oops with example?

531


#include #include #include #include void insert(struct btreenode **, int); void inorder(struct btreenode *); struct btreenode { struct btreenode *leftchild; struct btreenode *rightchild; int data; }; main() { struct btreenode *bt; bt=(struct btreenode *)NULL; int req,i=1,num; clrscr(); printf("Enter number of nodes"); scanf("%d",&req); while(i<=req) { printf("Enter element"); scanf("%d",&num); insert(&bt,num); i++; } inorder(bt); } void insert(struct btreenode **sr, int num) { if(*sr==NULL) { *sr=(struct btreenode *)malloc (sizeof(struct btreenode)); (*sr)->leftchild=(struct btreenode *)NULL; (*sr)->rightchild=(struct btreenode *)NULL; (*sr)->data=num; return; } else { if(num < (*sr)->data) insert(&(*sr)->leftchild,num); else insert(&(*sr)->rightchild,num); } return; } void inorder(struct btreenode *sr) { if(sr!=(struct btreenode *)NULL) { inorder(sr->leftchild); printf("\n %d",sr->data); inorder(sr->rightchild); } else return; } please Modify the given program and add two methods for post order and pre order traversals.

3250


write a program to find 2^n+1 ?

1549


What does no cap mean?

592


What does I oop mean?

616


Can destructor be overloaded?

599


What is the advantage of oop over procedural language?

628