can't solve the problem

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
double a=3.9;
double b=2.3;
int x;

x=floor(a);
cout<<endl<<"The floor value of a is : " <<x;

x=floor(b);
cout<<endl<<"The floor value of b is : " <<x;

x=ceil(a);
cout<<endl<<"The floor value of a is : " <<x;

x=ceil(b);
cout<<endl<<"The floor value of b is : " <<x;
getch();
}
Stop using whatever compiler you're using and get a C++ compiler. Your code is not C++ code and contains much out of date and horribly non-portable code.

Apart from that, what problem does this code not solve?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <math.h>
using namespace std;
int main(void)
{
char* str[255];
double a=3.9;
double b=2.3;


cout<< "The floor value of a is : "<< floor(a) << endl;


cout<< "The floor value of b is : "<< floor(b) << endl;


cout<< "The ceiling value of a is : "<< ceil(a)<< endl;


cout<< "The ceiling value of b is : "<< ceil(b) << endl;

/*dont use system("pause") unless your testing code or playing around with your own code, you can use this*/
fgets(str[255],255,stdin);
return 0;//thats why theres an int next to the def of the main function
}


The output is here:

the floor value of a is: 3
the floor value of b is: 2
the ceiling value of a is: 4
the ceiling value of b is: 3
_

I agree with Moschops get a good c++ compiler like devc++ or code::blocks
also study up on your c++ syntex, a good place is youtube look up thenewboston, on his page search "c++ tutoral"(thats where i learned my c++).
also make sure that you look for typos befor you submit a code.
Last edited on
I agree with Moschops get a good c++ compiler like devc++


No no, Dev-C++ is bad (and it's almost certainly what the OP is using). I expect you meant WxDev-C++. :)
Last edited on
of course i meant Wxdev-c++ *cough* *cough*(quickly downloads latest version)... i personal think that if your learning the language it dosent matter what ide you use, like if you were going to be learning java and were compiling the files using bluej instead of eclipse.
I used to use devc++. I like codeblocks better, it guesses things for you
i personal think that if your learning the language it dosent matter what ide you use


Unless one uses an IDE that comes bundled with a compiler that is simply not conformant; in that case, as with Dev-C++, one could end up learning something that isn't actually C++ and not know it.
Topic archived. No new replies allowed.