Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1)A complex number type is a primitive type in a very small set of programming l

ID: 3828741 • Letter: 1

Question

1)A complex number type is a primitive type in a very small set of programming languages.

What reasons would a language designers choose not to include a complex number type?

2) in C++ Write a simple function that returns the length of a string. The function prototype is as follows:

int getLengthOfString(char * string)

3) What is the pros of using a Record/Structure compared to a hetrogeneous arrays?

4)

Write a C function that find the sum of the values of an integer array A of a given range. The function prototype is as follows:

int A[] = {10, 9, 8, 7, 6, 5, 4 3, 2, 1};

int getSumSlice(int start, int end);

So the call to getSumSlice(1, 3) should return back the number 24 (9+8+7)

Explanation / Answer

Hi, I have answered Q2, and Q4.

please repost others in separate post.

Please let me know in case of any issue in answered part.

2) in C++ Write a simple function that returns the length of a string. The function prototype is as follows:
int getLengthOfString(char * string){
  
   int length = 0;
   while(string[length] != '')
       length++;

   return length;
}


4)
Write a C function that find the sum of the values of an integer array A of a given range. The function prototype is as follows:
int A[] = {10, 9, 8, 7, 6, 5, 4 3, 2, 1};
int getSumSlice(int start, int end){
  
   int sum = 0, i;
   for(i=start; i<=end; i++){
       sum = sum + A[i];
   }

   return sum;
}


So the call to getSumSlice(1, 3) should return back the number 24 (9+8+7)