Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: Leo the 28C (by Sulfurik)
Hello everyone! :D
OK, I read on a forum post that there was a "trunc" function in the "std lib" that removed decimal points off numbers... The problem is that this function doesn't exist!Look at my code:
----------
#include <iostream.h>
#include <stdlib.h>int main()
{
int age; // Age variable
cout << "Hello there!\n";
cout << "Please type in your age: ";
cin >> age;
cout << "Good, good... You'll die when you're " << trunc(age * 1.5) << " years old! HAHAHA!!!";
}
----------That function doesn't exist! I searched for it at http://www.cplusplus.com/ref/ but I didn't find it... Is there a FULL library reference out there that I can use? Can anyone help me? Thanks! ;)
PS#1: The forum post:
http://forums.devarticles.com/t10032/s.htmlPS#2: I'm using Borland's free C++ compiler.
PS#3: I hope not to die at the age the program told me...
http://www.xthost.info/sulfurik/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cxRuffle Mayo says ROFLMAO! :D

Yeah, it probably was for VC++... Thanks! ;)
http://www.xthost.info/sulfurik/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cxRuffle Mayo says ROFLMAO! :D

This is for Rimfire! Nothing seems to be working. I'm ready now to throw in the towl and take this thing to someone smarter than I. Thanks for all your help, your wonderful patience and time. You guys are great.
syvjackson

This might be kind of late but if you want to take a number like 123.456 and just get rid of the .456 then you can declare a int and set it equal to your decimal.
int num;
double dec = 123.45;num = dec;
cout << num;
will give 123

![]() |
Bug Hunt help plz
|
How to read whole file? (...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |