[solved] – Question 94409

Assignment 1: Silly Sentences

Expert Answer


[solved] – Question 9441

what does Modify_it()do?

#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);
}
free(temp_string);
return ret;
}

int main(int argc, char **argv) {
int8 data[32];

memset(data, 0x0A, sizeof(data));
int8 *resp = modify_it(0xFF, data, sizeof(data));

free(resp);

return 0;
}

Expert Answer


[solved] – Question 94429

Construct a program using conditional statement .In order to discourage excess electric consumption , an electrical company charges its customers a low rate of 7.5 pesos for each of the first 250 kilowatt-hours and a higher rate of 8.5 pesos for each additional kilowatt hour.In addition, a 10% surtax is added to the final bill.Write a program that calculates the electrical bill given the number of kilowatt hours consumed as input.At the end, print the number of kilowatt-hours consumed and the computed bill.

Expert Answer


[solved] – Question 94497

a.Use array responses for the 40 element array of student’s responses. Such as
int responses{RESPONSE_SIZE] = { 1, 2, 6, 4, 8, 5, 9, 7, 8, 10, 1, 6, 3, 8, 6, 10, 3, 8, 2, 7, 6, 5, 7, 6, 8, 6, 7, 5, 6, 6, 5, 6, 7, 5, 6, 4, 8, 6, 8, 10}
The output should be similar to the one below:

Expert Answer


[solved] – Question 94516

In Java programming language, there are several methods in a class that have the same name but different
arguments/signatures. This concept is called method overloading. Now, create a class that have several methods
to add two numbers and return the total value as below:

sum (int numberOne, int numberTwo)
– return value is int
sum (float numberOne, float numberTwo)
– return value is float
sum (int numberOne, float numberTwo)
– return value is float

Expert Answer


[solved] – Question 94540

Write a program that takes three numbers as input and prints the largest.

Sample run:

Enter a number: 20
Enter a number: 50
Enter a number: 5
Largest: 50

Expert Answer


[solved] – Question 94608

I need to function to draw an equilateral triangle in C++. with # as the border and ‘*’ as the filler after accepting the size from the user.

Expert Answer


[solved] – Question 94612

A lightning flash:
between the forest trees
I have seen water.
– Shiki

Expert Answer


[solved] – Question 94638

Consider the following program and answer the following
for(int I =1; I<=10; I+=3)
printf (“%dn”I);
How many times the for loop executed?

Expert Answer


[solved] – Question 94653

Calculate ∑_(i=0)^111〖3^i C(111,i)〗

Expert Answer