0

Whis the output that i get by runin it =420... (code is in description)

#include <iostream> using namespace std; int main() { int myVariable = myVariable ; cout << myVariable; return 0; }

14th Oct 2016, 9:32 PM
Pranam modi
Pranam modi - avatar
2 Answers
+ 1
you are assigning the integer variable (int, which is a per definition a number datatype) a series of characters which are not numbers. my guess would be that the compiler converts these characters to numbers. how? if you google for a ascii table you will find that certain characters are stored under certain numbers. so it converts these characters to those numbers and what you get is a number instead of those characters
15th Oct 2016, 2:32 AM
Van Tuan Tran
Van Tuan Tran - avatar
+ 1
you put a word into a variable, but computer stores it as integers and translates it into binary code (0101.......), and then you want computer to output integers. it will give you the number you wanted.of course, it has already been transformed into decimal numbers.
16th Oct 2016, 1:53 AM
shaozijian007