Question

Alt Ctrl 3. Write a program segment that uses array to read in double the values that stored in List List_ A and List B (8 pts) 6 numbers to a List A, and then d copy the numbers to List B. Print both
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>

using namespace std;

int main()

{

//declaring 2 lists

int List_A[6],List_B[6];

int i,j;

//inputting elements in list_A

cout<<"Enter 6 elements to be inserted into List_A one by one : ";

for(i=0;i<6;i++)

{

cin>>List_A[i];

//doubling the values of List_A

List_A[i]=2*List_A[i];

//copying the values of List_A in List_B

List_B[i]=List_A[i];

}

//displaying list_A

cout<<"List_A : ";

for(i=0;i<6;i++)

cout<<List_A[i]<<" ";

cout<<endl;

//dispaling list_B

cout<<"List_B : ";

for(i=0;i<6;i++)

{

cout<<List_B[i]<<" ";

}

}

Sample output:-

F:ACodes Untitled1.exe Enter 6 elements to be inserted into List A one by one 5 4 6 7 2 3 List A 10 8 12 14 4 6 List B 10 8 12 14 4 6 Process exited after 4.838 seconds with return value 0 Press any key to continue.

Add a comment
Know the answer?
Add Answer to:
Alt Ctrl 3. Write a program segment that uses array to read in double the values...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a java program that create a 2 dimensional array of type double of size 10...

    Write a java program that create a 2 dimensional array of type double of size 10 by 10. Fill the array with random numbers using a random number generator. Print the array contents. Write a java program that creates a file called data.txt that uses the PrintWriter class. Write the numbers 1 to 42 into the file. Close the file. Attach both files. Thank you in advance

  • Write a java program that will read the values for 3 matrices A, B, and C...

    Write a java program that will read the values for 3 matrices A, B, and C and store the result of their summation in matrix D. You need to use a method to read matrix values. Use another method to add the three 3x3 matrices (each is a 2 dimensional array with 3 rows and 3 columns). Finally, use a third method to print the value of the summation (matrix D). Write a test program that will cal the three...

  • QUESTION 25 Examine the following program segment. Assuming the array table has values in it, what...

    QUESTION 25 Examine the following program segment. Assuming the array table has values in it, what is the correct outcome? double table [10] [2], sum=0.0; int i, j, nrows=10; for(i=0; i<=nrows-1; i++) sum += tableta (3); It will sum the table values in the rows only. It will sum the table values in the columns only. It will not sum the table values because nrows is too small. It will not sum the table values because the columns are not...

  • Write a C++ program to : Create array arr1 of size 10 Assign values to elements...

    Write a C++ program to : Create array arr1 of size 10 Assign values to elements such that - say index = i, arr1[i] = 10 - i. Print arr1 Create arr2 and copy alternate elements from arr1 starting from index 1. Print arr2. Sort arr1 in ascending array and print its elements from indices 3 to 8 Print every output on a different line and separate array elements by spaces.

  • Write a program that first reads an integer for the array size, then reads double values...

    Write a program that first reads an integer for the array size, then reads double values into the array, and displays the number of values greater than the average. Enter array size: 6 Enter a number: 1.1 Enter a number: 2.2 Enter a number: 3.4 Enter a number: 3.9 Enter a number: 5.5 Enter a number: 8.75 The number of values greater than the average is 2

  • Write a C++ that read a list of numbers from a .txt file into array. The...

    Write a C++ that read a list of numbers from a .txt file into array. The first digit on the list will be array size, while the second number on the list will be our first number in our array list. Example: t1.txt file contain list off input number: 5, 3, 6, 10, 43, 23. notice the first number is 5 which will need to be use as an array size and the rest of the numbers are in the...

  • I need to Write a test program that prompts the user to enter 10 double values...

    I need to Write a test program that prompts the user to enter 10 double values into an array, calls a method to calculate the average of the numbers, and displays the average. Next, write a method that returns the lowest value in the array and display the lowest number. The program should then prompt the user to enter 10 integer values into an array, calculates the average, and displays the average. The program should have two overloaded methods to...

  • 3. Write a program to read a (binary) file of integers, sort the integers, and write...

    3. Write a program to read a (binary) file of integers, sort the integers, and write them back to the same file. Assume that all the numbers can be stored in an array. (Exercise 3) 4. Repeat exercise 3, but assume that only 20 numbers can be stored in memory (in an array) at any one time. Hint: you will need to use at least two additional files for temporary output. Please finish the question in C language programming, thank...

  • c++ no pointers just follow instructions Write a program (array.cpp) that read positive floating point numbers...

    c++ no pointers just follow instructions Write a program (array.cpp) that read positive floating point numbers into an array of capacity 100. The program will then ask for one of three letters(A, M or S). if the user inputs something other than one of these letters, then the program should ask for that input until an A, M, or S is entered. A do-while loop should be used for this. If the user inputs an A, then the program should...

  • WRITE A PROGRAM IN C THAT DOES THE FOLLOWING: The numbers are real numbers, read in...

    WRITE A PROGRAM IN C THAT DOES THE FOLLOWING: The numbers are real numbers, read in as double precision floating-point numbers, one number perline, possibly with some white space before or after. Hint: use scanf. There are guaranteed to be no more than one million (that’s 10^6) numbers in the input, and no fewer than two legitimate numbers. Any number that is equal to zero should be ignored (discarded, not stored in the array or counted in any way).

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT