binary

Gigabyte or Gibibyte (1000 or 1024)?

本小妞迷上赌 提交于 2021-01-26 18:38:55
问题 This may be a duplicate and I apologies if that is so but I really want a definitive answer as that seems to change depending upon where I look. Is it acceptable to say that a gigabyte is 1024 megabytes or should it be said that it is 1000 megabytes? I am taking computer science at GCSE and a typical exam question could be how many bytes in a kilobyte and I believe the exam board, AQA, has the answer for such a question as 1024 not 1000. How is this? Are both correct? Which one should I go

Gigabyte or Gibibyte (1000 or 1024)?

和自甴很熟 提交于 2021-01-26 18:37:52
问题 This may be a duplicate and I apologies if that is so but I really want a definitive answer as that seems to change depending upon where I look. Is it acceptable to say that a gigabyte is 1024 megabytes or should it be said that it is 1000 megabytes? I am taking computer science at GCSE and a typical exam question could be how many bytes in a kilobyte and I believe the exam board, AQA, has the answer for such a question as 1024 not 1000. How is this? Are both correct? Which one should I go

Gigabyte or Gibibyte (1000 or 1024)?

ⅰ亾dé卋堺 提交于 2021-01-26 18:37:52
问题 This may be a duplicate and I apologies if that is so but I really want a definitive answer as that seems to change depending upon where I look. Is it acceptable to say that a gigabyte is 1024 megabytes or should it be said that it is 1000 megabytes? I am taking computer science at GCSE and a typical exam question could be how many bytes in a kilobyte and I believe the exam board, AQA, has the answer for such a question as 1024 not 1000. How is this? Are both correct? Which one should I go

cpp byte file reading

随声附和 提交于 2021-01-25 08:23:49
问题 Im trying to read a byte file with fstream in c++ (goal: binary data format deserialization). The dat file looks something like below in HxD Hex editor (bytes.dat): but something goes wrong when reading the binary file into a char array.. here is a mwe: #include <iostream> #include <fstream> using namespace std; int main (){ ofstream outfile; outfile.open("bytes.dat", std::ios::binary); outfile << hex << (char) 0x77 << (char) 0x77 << (char) 0x77 << (char) 0x07 \ << (char) 0x9C << (char) 0x04

Integer to Binary in C

这一生的挚爱 提交于 2021-01-24 10:53:10
问题 I am new to C programming and unsure what is wrong with my program. I am writing a program which takes an integer as an input and returns it in binary form. An input of 43 would output 101011, but the output is 1. Please advise. #include <stdio.h> #include <string.h> void printBinaryForm( int X ) //Purpose: Print parameter X in binary form //Output: Binary representation of X directly printed //Assumption: X is non-negative (i.e. >= 0) { //[TODO] CHANGE this to your solution. int input = X;

Integer to Binary in C

情到浓时终转凉″ 提交于 2021-01-24 10:53:05
问题 I am new to C programming and unsure what is wrong with my program. I am writing a program which takes an integer as an input and returns it in binary form. An input of 43 would output 101011, but the output is 1. Please advise. #include <stdio.h> #include <string.h> void printBinaryForm( int X ) //Purpose: Print parameter X in binary form //Output: Binary representation of X directly printed //Assumption: X is non-negative (i.e. >= 0) { //[TODO] CHANGE this to your solution. int input = X;

Integer to Binary in C

烈酒焚心 提交于 2021-01-24 10:52:42
问题 I am new to C programming and unsure what is wrong with my program. I am writing a program which takes an integer as an input and returns it in binary form. An input of 43 would output 101011, but the output is 1. Please advise. #include <stdio.h> #include <string.h> void printBinaryForm( int X ) //Purpose: Print parameter X in binary form //Output: Binary representation of X directly printed //Assumption: X is non-negative (i.e. >= 0) { //[TODO] CHANGE this to your solution. int input = X;

Converting binary to decimal integer output

馋奶兔 提交于 2021-01-21 06:47:11
问题 I need to convert a binary input into a decimal integer. I know how to go from a decimal to a binary: n = int(raw_input('enter a number: ')) print '{0:b}'.format(n) I need to go in the reverse direction. My professor said that when he checks our code, he is going to input 11001 , and he should get 25 back. I've looked through our notes, and I cannot figure out how to do this. Google and other internet resources haven't been much help either. The biggest problem is that we are not allowed to

Converting binary to decimal integer output

拜拜、爱过 提交于 2021-01-21 06:47:11
问题 I need to convert a binary input into a decimal integer. I know how to go from a decimal to a binary: n = int(raw_input('enter a number: ')) print '{0:b}'.format(n) I need to go in the reverse direction. My professor said that when he checks our code, he is going to input 11001 , and he should get 25 back. I've looked through our notes, and I cannot figure out how to do this. Google and other internet resources haven't been much help either. The biggest problem is that we are not allowed to

Converting binary to decimal integer output

£可爱£侵袭症+ 提交于 2021-01-21 06:46:09
问题 I need to convert a binary input into a decimal integer. I know how to go from a decimal to a binary: n = int(raw_input('enter a number: ')) print '{0:b}'.format(n) I need to go in the reverse direction. My professor said that when he checks our code, he is going to input 11001 , and he should get 25 back. I've looked through our notes, and I cannot figure out how to do this. Google and other internet resources haven't been much help either. The biggest problem is that we are not allowed to