okay, i know i might be boring with my questions but could someone tell me how can i read an array of floats mixed with ints and then print them out same as they were on input...?
typecasting thing again? anyone knows a good book i could use to stop torturing this forum, i got the c++ primer but it aint helpful at all. and i don't wanna hear B from Bjarne...
wellibedamned
0
Light Poster
Recommended Answers
Jump to Postyou noob. you're banned.
just kidding.
but seriously, you cant have a single array of floats "mixed with" ints.
they're all either one or the other. probably floats. some of the floats just happen to not have any fractional part.
i'm not sure i fully understand …
Jump to Postyou cant have a single array of floats "mixed with" ints
You can have an array with different data types, you just need to point to them using void*
example:
void *array[] = {(int*)123, (char*)"Hello"}; cout << (int)array[0]; // prints 123 cout << (char*)array[1]; // prints …
All 5 Replies
jephthah
1,888
Posting Maven
wellibedamned
0
Light Poster
jephthah
1,888
Posting Maven
William Hemsworth
1,339
Posting Virtuoso
jephthah
commented:
good call
+3
jephthah
1,888
Posting Maven
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.