I dont know how long I've been trying to figure this out but I havent got to an answer.... I believe that there must be a way of converting an integer to a double or visa versa but I cant think how... I always thought parseInt or parseDouble wud work well on C++ but all it does is giving me errors... I guess thats a Java syntax not C++ can anyone help me
Traicey
10
Posting Whiz in Training
Recommended Answers
Jump to Postif i'm not wrong you can directly assign an integer to a double in c++, there's no need to do an explicit casting.
Jump to PostIt's called "typecasting".
int a = 5; double b = (double) a; double c = 4.0; int d = (int) c;
chandra.rajat is correct in many cases. The compiler will figure out the typecasting above without being told and unlike Java, C++ doesn't demand all of the …
All 7 Replies
Agni
370
Practically a Master Poster
Featured Poster
VernonDozier
2,218
Posting Expert
Featured Poster
Traicey
10
Posting Whiz in Training
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Traicey
10
Posting Whiz in Training
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Traicey
10
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.