• 博客(0)
  • 资源 (4)

空空如也

c语言或者c++ :Bit manipulations 位操作

Define an unsigned long integer and initialise it to the binary pattern: 0101 1111 0001 1000 1001 0010 1101 0011 Using hexadecimal notation print the hex value on the console. Write a function to print a long integer on the console in hex and binary form. Now perform the following operations on the pattern and print out the results of each operation in hex and binary format. Right shift the binary pattern by 4 bits. Left shift the pattern by 6 bits. AND the value with the long int 0x3 AND the value with the char 0x3 OR the value with the unsigned short 0xf00f Exclusive OR the value with the long int 0xF0F0F0F0

2013-12-10

c或者c++: Structures 结构

Create a structure called Struct1 with the following member variables: A short integer A long integer A string of 64 characters A double precision floating point variable Create a second structure called Struct2 with the following members A short integer Two long integers An instance of Struct1 Now write a program that creates a single instance of a structure of type Struct2. Read its member variables from the console one at a time. Create a second instance of Struct2 and copy al the variables from the first instance to the second in a single statement. Print out the members variables of the second structure to confirm that the copy was successful.

2013-12-10

Dynamic Memory Allocation 动态内存分配

Read a list of long integers from the console and store the numbers in a dynamically created array. The first number read specifies the number of long integers in the list. When the list is loaded into the memory buffer. Write it out to the console in the reverse order in which it was read.

2013-12-10

C语言或者C++:2D and 3D arrays

Define a two-dimensional long integer array A of 3 rows and 4 columns. Fill the elements of the arrays with the numbers 1 - 12 in the order 1 2 3 4 5 6 7 8 9 10 11 12 Define another array B that will hold the elements of the transpose of A. Make up the transpose array and print it on the console. Now define a pointer that you can use to access the elements of the Arrays A and B. Use it to print out the elements A(2,4) and B(2,1) Check that you have printed the correct values. Declare a 3D array C, big enough to store two copies of array A and copy array A into C twice.

2013-12-10

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除