[solved] – Question 9280

UNIX operative system is based on C++ ?
A Matlab program does not need formal compilation?
LINSPACE is used to create a vector with elements equally spaced?

Expert Answer


[solved] – Question 9281

Lcal variables are variables that are shared ?

Expert Answer


[solved] – Question 9284

1. What does the function modify_it() do?

2. What are any issues or problems that you see with it?

3. How could you improve the function, and what benefits would your improvements bring?

4. What other additional improvements could you make to the rest of the code?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>

typedef int int32;
typedef char int8;

void change_it(int8 *output, int8 *input_1, const int8 *input_2, int32 length)
{
int32 i = 0;

for(i=0; i<length; i++)
{
output[i] = (int8)(input_1[i] ^ input_2[i]);
}

return;
}

void itoa( int32 num, int8 *alpha, int32 radix )
{
if( radix == 10 )
{
sprintf(alpha, “%i”, num);
}
else if( radix == 16 )
{
sprintf(alpha, “%X”, num);
}
}

int8 *modify_it(int32 modifier, const int8 *input_1, int32 length)
{
int8 leading[3];
int32 i_leading;
int8 * temp_string = NULL;
int8 * ret;
int32 i = 0;

itoa(modifier/2, leading, 10);
i_leading = atoi(leading);
temp_string = (int8 *) malloc(8);
ret = (int8 *) malloc(length);
memset(temp_string, 0, 8);
temp_string[0] = 0;

if( (modifier+1)%2 == 0 ) {
temp_string[0] = (int8)((i_leading<<4) + 8);
}
else {
temp_string[0] = (int8)(i_leading<<4);
}

for(i=0; i<(length>>3); i++)
{
change_it(ret+i*8, temp_string, input_1+i*8, 8);
}

Expert Answer


[solved] – Question 92845

Design and implement a class called Laptop that contains instance data for the manufacturer , processor, ram capacity , and model price. Define the Laptop constructor that accepts and initializes these variables. Include getters and setters for all instance data. Include a toString method that returns a nicely formatted multiline description of the Laptop. Create a driver class called LaptopCollection whose main method instantiates and updates several Laptop objects.

Expert Answer


[solved] – Question 92885

In java statement int a=10,b=8; its right or wrong?

Expert Answer


[solved] – Question 92915

Write a program to convert a number from a binary representation to a decimal format—that is, from base 2 to base 10. Your program should make use of recursion to do the conversion.

Expert Answer


[solved] – Question 92916

A number of the form a + ib, in which i2 = -1 and a and b are real numbers, is called a complex number. We call the real part and b the imaginary part of a + ib. Complex numbers can also be represented as ordered pairs (a, b). The addition and multiplication of complex numbers are defined by the following rules: (a + ib) + (c + id) = (a + c) + i(b + d ) (a + ib) * (c + id) = (ac – bd) + i(ad + bc) Using the ordered pair notation, these rules are written as: (a, b) + (c, d) = ((a + c), (b + d )) (a, b) * (c, d) = ((ac – bd ), (ad + bc)) C++ has no built-in data type that allows us to manipulate complex numbers. Construct a data type, complex Type, that can be used to process complex numbers. Overload the stream insertion and stream extraction operators for easy input and output. We will also overload the operators + and * to perform addition and multiplication of complex numbers. If x and y are complex numbers, we can evaluate expressions such as x + y and x * y.

Expert Answer


[solved] – Question 92972

For each of the following mention whether it is a valid identifier

_x @x x@y x3 3x

Note- answer as y or n for each of these.

Expert Answer


[solved] – Question 92973

What will be printed because of the following code?

int x=5;
double xx=5;
cout << 1/2*x << endl;
cout << 1/2*xx << endl;
cout << x/2 << endl;
cout << xx/2 << endl;

Note- ignore newline (endl) while answering.

Expert Answer


[solved] – Question 92974

What is printed because of the following code?

int x = 2;
repeat(4){ x = x*x; }
cout << x << endl;

Expert Answer