Arrays Homework Assignment #6 (6%) Due Date: March 17,2016 Some homework problem
ID: 3678798 • Letter: A
Question
Arrays Homework Assignment #6 (6%) Due Date: March 17,2016 Some homework problems taken directly from the textbook: 1) Write single statements that perform each of the following single-scripted array operations a) Initialize the 10 elements of integer array counts to zeros. b) Add 1 to each of the 15 elements ofinteger array bonus. c) Read the 12 values of floating point array monthlyTemperature from the keyboard. d) Print the 5 values of integer array bestScores in column format 2) Identify the error in the following code segment. When will the error be detected? #includeExplanation / Answer
3)
ans:
->anArray1[1..8]=9.25; in c language this kind of initialization is not allowed.its shows too many decimal points.
use for loop for 1 to 8 to initialize as for(i=1;i<=8;i++)anArray1[i]=9.25;
->array have index but it is not a function.as in code anArray1(1)=-23.5; compiler shows L value required
->in c we can't assign one array values into another array. as anArray1=anArray2;
using loop for indexs in array1 to array2
->anArray1[1..5]=anArray[1..5] it will give error as too many decimal points
use loop statements to assaign those values
in assiagn a values to array these kind of errors occured
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.