473,320 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to show in screen numbers greater than 32 bits

Well, If I am using the command __int64, wich is a variable of 64 bits, how can show this variable in the computer screen, for example using cout

_int64 x = . . . . .. . .

cout << x;

If I do it this way the compiler says that << is is ambiguous. thanks
Aug 16 '06 #1
3 2721
Banfa
9,065 Expert Mod 8TB
cout does not support __int64 use printf

__int64 i = 0x1000000000000000i64;
printf("%I64d\n", i);
Aug 16 '06 #2
Hi, when I execute the following why the printf function show something wrong:

#include<limits.h>
#include<stdio.h>
#include <iostream> // librería para uso de cout
using namespace std;

class Rotation {
unsigned __int64 K;
short int desplazar;
public:
Rotation (unsigned __int64, short int);
unsigned __int64 RotaionalLeftShift()
{
unsigned __int64 top_bits = 0;

top_bits = K >> (sizeof K * CHAR_BIT) - desplazar;

K <<= desplazar;

K |= top_bits;
return K;
}
};

Rotation::Rotation (unsigned __int64 a, short int b) {
K = a;
desplazar = b;
}

int main () {
unsigned __int64 nuevo1 = 0, nuevo2 = 0 ;
Rotation rect (0xafffffffffffffff,4);
Rotation rectb (0xadeaffffffffffff,4);
nuevo1 = rect.RotaionalLeftShift();
nuevo2 = rectb.RotaionalLeftShift();

printf("%I64d\n", nuevo1);
printf("%I64d\n", nuevo2);
return 0;
}
Aug 16 '06 #3
Banfa
9,065 Expert Mod 8TB
Because in printf %d is for signed integers but you are using unsigned integers (I'm guessing since you haven't accurately described what is wrong.

You need to use %u for unsigned integers and for unsigned 64 bit integers you need to use %I64u
Aug 16 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Brian van den Broek | last post by:
Hi all, I guess it is more of a maths question than a programming one, but it involves use of the decimal module, so here goes: As a self-directed learning exercise I've been working on a...
33
by: patrick_woflian | last post by:
hey guys, im just writing a basic calculation at the moment, before building on it for an A-Level piece of work. i can add/divide etc... two numbers together yet i am having a major problem with...
21
by: News | last post by:
I want to display hex numbers in a <input type-"text:> how do I do it?
17
by: Sri | last post by:
How do you add an n-bit number in C? Regards, Sri
45
by: bobalong | last post by:
Hi I'm have some problem understanding how JS numbers are represented internally. Take this code for an example of weirdness: var biggest = Number.MAX_VALUE; var smaller = Number.MAX_VALUE...
39
by: Frederick Gotham | last post by:
I have a general idea about how negative number systems work, but I'd appreciate some clarification if anyone would be willing to help me. Let's assume we're working with an 8-Bit signed integer,...
11
by: balakrishnan.dinesh | last post by:
hi frnds, Im having two 20digit numbers, But while comparing those it is giiving wrong ouput in javascript. for example here is my code, my secanrio is , ~ If first 20 digit number is...
13
by: Peter Oliphant | last post by:
I would like to be able to create a random number generator that produces evenly distributed random numbers up to given number. For example, I would like to pick a random number less than 100000,...
12
by: electric916 | last post by:
I have a homework assignment i Am totally confused on. I started with a basic code to determine if a number is prime or not, but need guidance from here. I will post assignment details then what I...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.