computer science

posted by .

Cyborg data type sizes. You have been given a job as a programmer on a Cyborg supercomputer. In order to accomplish some calculations, you need to know how many bytes the following data types use: char, int, float, and double. You do not have any manuals, so you can’t look this information up. Write a C++ program that will determine the amount of memory used by these types and display the information on the screen.

  • computer science -

    // Programming Challenges of Chapter 2 on P77
    // Written by Lanchuan Chang

    #include <iostream>
    using namespace std;

    int main()
    {
    // 9. Cyborg Data Type Sizes
    cout << " the size of a char is " << sizeof(char) << " bytes.\n";
    cout << " the size of an int is " << sizeof(int) << " bytes.\n";
    cout << " the size of a float is " << sizeof(float) << " bytes.\n";
    cout << " the size of a double is " << sizeof(double) << " bytes.\n";

    return 0;

    }

  • computer science -

    HAHAHAAHAHAHAHA

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. IT210

    Identify at least two data structures that are used to organize a typical file cabinet. Post actual pseudocode or code examples of these data structures. Why do you feel it is necessary to emulate these types of data structures in …
  2. computer science

    The variable cp_arr has been declared as an array of 26 pointers to char. Allocate 26 character values, initialized to the letters 'A' through 'Z' and assign their pointers to the elements of cp_arr (in that order). int *arr1[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; …
  3. C code

    //INSTRUCTIONS //Your parser will read from input.txt //input.txt consists of a series inputs that you need to read. //each input is proceeded by a flag. //Each flag will be either I,C, or F. //I means int C means char F means float. …
  4. computer science

    Im trying to create an arraylist that's sorted but I have no idea how to sort the numbers. I cant use the array.sort method here is my code: public class Testing { private int [] data; private int count; private static int defCapacity …
  5. programming

    m trying to create an arraylist that's sorted but I have no idea how to sort the numbers. I cant use the array.sort method here is my code: public class Testing { private int [] data; private int count; private static int defCapacity …
  6. Computers C++

    1). After the assignment statement result = isspace('\t'); result has the value ________. 2). The data type of islower('g') is ________. 3). What will be output given the following information: float * pointer; float pay = 3.75; pointer …
  7. Computer Science

    (From Lesson 17 of Blue Pelican Java) Use the following code for problems 1 – 15. In each problem state what’s printed. String s = “Lucky hockey puck”; String m = “uck”; int j = 6, z = 99; 1. int k = s.indexOf(m); System.out.println(k); …
  8. C++

    (4 points) Identify the errors in the following statements. int* p = &44; - i think the star is the error because pointers are supposed to be like *p?
  9. Java Programming Algorithm Help

    Ok so for my assignment, I have to have two String inputs. For example, "1.021" and "2.51" And I need to calculate the difference between these strings (biggest number minus smaller). I can only use the data types: short, char, boolen …
  10. Java

    1. Which of the following expression evaluates to a value of 15?

More Similar Questions