subject
Computers and Technology, 15.06.2020 00:57 vargass

Include the following header files in your program: string, iomanip, iostream Suggestion: code steps 1 thru 4 then test then add requirement 5, then test, then add 6, then test etc.

Add comments to display assignment //step 1., //step 2. etc. This program is to have no programmer created functions. Just do everything in main and make sure you comment each step so I can grade more easily. Also, this program will be expanded in Chapter 9 to use pointers.

Create a program which has:
1. The following arrays created:
a. an array of double with 5 elements, dArr
b. an array of long, lArr, with 7 elements and initialized at the time of creation with the values
100000, 134567, 123456, 9, -234567, -1, 123489
c. a 2 dimensional array of integer, with 3 rows and 5 columns, iArr.
d. an array of char with your name initialized in it. Big enough for 30 typable characters, sName.
2. define 3 variables, , cnt1 and cnt2 (short data types) as general purpose counters and a long double total
3. define 1 long variable called highest
4. a for loop to put a random number into each of the elements of the array of double, dArr. Use rand() and seed a random starting point with srand(). Use a for loop to display all of the values in dArr.
5. another for loop to add up the array of double, dArr, into the variable total
6. one cout to print the total and another cout to print the average of the double array, dArr.
7. a for loop similar to the following for the long array, lArr:
for ( cnt1 = 1, highest = lArr[0] ; cnt1 < 7 ; cnt1++ )
{
//logic to compare each array element, starting with lArr[1], with highest
//replace highest if the value in lArr[cnt] is higher than the value in variable highest
}

8. a cout to print highest as derived in the above code
9. a for loop to put a random number, each with a value no lower than 1 and no higher than 53, into each element of iArr, the array of integer, seed the random generator with srand( (unsigned) time(NULL)). Only have to run srand once…. Use the modulo operator similar to the way you did with dice rolls in Project 2.
10. a separate loop to print iArr with 3 rows on your screen. Each row has 5 numbers. Use setw to control the width of each column. See Chapter 3 for an example of a program using setw. Print row by row.
11. a loop to print the 2 dimensional array, iArr, so that all 3 numbers in column 0 are printed and then on the next line all 3 numbers in column 1, etc. thru column 4. Print column by column.
12. Use cin. getline( ) to type another name into the variable sName.
13. Print the ascii value of each character in the char array, 1 per line. Use a while loop and look for the '\0' as a signal to end.
14. make the array of char, sName, have the name "Albert Einstein" in it. You must use strcpy_s function.
15. print the ascii value of the 12th character of the string sName

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, kadariusmerchan
Determine which of the four levels of measurement (nominal, ordinal, interval, ratio) is most appropriate for the data below. internet speed levels of "fast comma " "medium comma " and "slow" choose the correct answer below. a. the ordinal level of measurement is most appropriate because the data can be ordered comma but differences left parenthesis obtained by subtraction right parenthesis cannot be found or are meaningless. nothing nothing nothing nothing nothing b. the interval level of measurement is most appropriate because the data can be ordered comma differences left parenthesis obtained by subtraction right parenthesis can be found and are meaningful comma and there is no natural starting point. c. the nominal level of measurement is most appropriate because the data cannot be ordered. nothing d. the ratio level of measurement is most appropriate because the data can be ordered comma differences left parenthesis obtained by subtraction right parenthesis can be found and are meaningful comma and there is a natural starting point.
Answers: 2
image
Computers and Technology, 22.06.2019 11:00, sjackson0625p8w1a0
Which action is good business etiquette? a. switching your cell phone off before you enter a meeting b. keeping your cell phone on low volume before you enter a meeting c. setting a pleasant ring tone on your cell phone before you enter a meeting d. setting a standard ringtone on your cell phone before you enter a meeting
Answers: 1
image
Computers and Technology, 22.06.2019 15:30, DestinyK8033
Why would a programmer use the logical operator and in an if statement? a: when an action is to be taken that requires both conditions to be falseb: when an action is to be taken that requires both conditions to be truec: when an action is to be taken that requires the first condition to be falsed: when an action is to be taken that requires the second condition to be truei took the test and the answer is b.
Answers: 3
image
Computers and Technology, 23.06.2019 01:20, shiann2002
Me with this program in c++ ! computers represent color by combining sub-colors red, green, and blue (rgb). each sub-color's value can range from 0 to 255. thus (255, 0, 0) is bright red. (130, 0, 130) is a medium purple. (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (in other word, equal amounts of red, green, blue yield gray).given values for red, green, and blue, remove the gray part. ex: if the input is 130 50 130, the output is: 80 0 80. thus, find the smallest value, and then subtract it from all three values, thus removing the gray.
Answers: 3
You know the right answer?
Include the following header files in your program: string, iomanip, iostream Suggestion: code step...

Questions in other subjects:

Konu
Mathematics, 22.10.2020 18:01
Konu
Mathematics, 22.10.2020 18:01
Konu
Mathematics, 22.10.2020 18:01