it puzzles me why dont you start with int from the beginning and save yourself the trouble of converting? because "cin" can take int input also...
Type: Posts; User: nextus
it puzzles me why dont you start with int from the beginning and save yourself the trouble of converting? because "cin" can take int input also...
i am currently using 2005 express microsoft c++....and for some reason i cant use
#include <windows.h>
does anybody know why??? help?
1) the number of integers in the series (not including zero)
2) the average of the integers
3) the largest integer in the series
4) the smallest integer in the series
5) the range (difference...
#include <iostream>
using namespace std;
int Number(int, int);
int Add(int*, int*, int*);
int main()
{
int a[5] = {1,2,3,5,10};
YES...and YES
1) your Add() function is declaring local variables...they will die at the end of the scope...so you will have junk values or get a compiler error when you try to refer to them in...
not bad actually
function prototypes...... :)
return 0;
this ends the program and returns control to your operating system. it aslo return the value 0 to the operating system. other values can be returned to indicate different end...
return 0;
this ends the program and returns control to your operating system. it aslo return the value 0 to the operating system. other values can be returned to indicate different end...
everyone has their own way or style to looking at problems and solving them. the more you program the more consistent you will be at choosing a solution to a problem you have. and you're in need of a...
"Programming Windows, 5th edition" -Charles Petzold
very very good book :)
i might be wrong..but i thought cin >> does not read any white spaces...(thats including the newline character...)....
well lets work on your example...enum does allow ranges...so if you have
enum colors { red = 1, blue = 10 };
colors myColor = static_cast<colors>(5); //perfectly legal!
nice rebuttal Zach...took the words right out of my mouth
for me i never assume an automatic conversion will take place...i rather explicitly tell the compiler that i am casting the value into another..its just a safe caution for me....
an enumerated data type will be cast automatically to the appropiate type, but the reverse isnt true..there is no automatic conversion from an integer type to a enumeration type
so using your...
and if you want to show the base output std::showbase to the stream so it would show 0x20
;)
[QUOTE=xErath]Wrong! ;)
decimal 12 in binary is 00001100
decimal 34 in binary is 00100010
decimal 1234 in binary is 00000100 11010010
12 ^ 00 = 0 (00000000)
34 ^ 15 = 45 (00101101)
1234 ^...
As i stated:
also even though you are using base 10 representation (decimal representation) your computer represent your variable values in binary form already..so in reality your computer is...
well shifting bits (>> or <<) can either be multiplying or dividing by 2^n times....
shifting left 2
<< 2
is the same as timing by 2^2
shifting right 2
>> 2
is the same as dividing 2^2
http://www.gametutorials.com/Tutorials/win32/Win32_Pg3.htm
Programming Windows by Charles Petzold
If you are just learning to program C++ then just stick with the mac because you can learn C++ by just writing console programs...the more complicated things get platform specific (except with...
integer division....you can easily cast one of the variables to a float or double type and that would work too :)
well the new windows64 bits be really different to what we are doing now (win32api)??..or will it be backwards comptabile..etc..etc?? like most of win32api is C related..so is the win64api going to...