
1.
Code:
#include<iostream>
using namespace std;
int size;
void get_array(int *array)
{
cout<<"Enter elements: ";
for(int i=0;i<size;i++)
cin>>*(array+i);
}
void process_arrays(int *array1, int *array2, int *array3)
{
for(int i=0;i<size;i++)
{
*(array3+i) = *(array1+i) +
*(array2+i);
}
}
void show_array(int *array)
{
for(int i=0;i<size;i++)
cout<<*(array+i)<<" ";
}
int main()
{
cout<<"Enter size: ";cin>>size;
int *array1, *array2, *array3;
array1 = new int[size];//allocate memory
array2 = new int[size];
array3 = new int[size];
get_array(array1);//read arrays
get_array(array2);
process_arrays(array1, array2, array3);//generate
array3
show_array(array3);
}
Output:

2.
(k/10n)%10 gives nth digit in a number
Code:
#include<iostream>
using namespace std;
int main()
{
int num;
while(1)
{
cin>>num;
if(num<0) break;
cout<<"digits are: ";
int k=num;
cout<<(k/10000)%10<<"
"<<(k/1000)%10<<" "<<(k/100)%10<<"
"<<(k/10)%10<<" "<<k%10<<endl;
int sum=0;
sum=sum + (k/10000)%10 +
(k/1000)%10 + (k/100)%10 + (k/10)%10 + k%10;
cout<<"sum of digits:
"<<sum<<endl;
}
}
Output:

i need help writing these programs in c++ format 1. Enter two integer arrays: array1-129, 0,...
PLEASE HELP!!!I need help with the following JAVA PROGRAMS.
Please ready carefully. So this comes from tony
gaddis starting out with java book. I have included the screenshot
of the problems for reference. I need HELP implementing these two
problems TOGETHER. There should be TWO class files. One which has
TWO methods (one to implement problem 8, and one to implement
problem 9). The second class should consist of the MAIN program
with the MAIN method which calls those methods....
This C++ Programs should be written in Visual studio 2017 PROGRAM 1: Comparing Using Arrays to Using Individual Variables One of the main advantages of using arrays instead of individual variables to store values is that the program code becomes much smaller. Write two versions of a program, one using arrays to hold the input values, and one using individual variables to hold the input values. The programs should ask the user to enter 10 integer values, and then it...
Develop a system flowchart and then write a menu-driven C++ program that uses user-defined functions arrays, and a random number generator. Upon program execution, the screen will be cleared and the menu shown below will appear at the top of the screen and centered. The menu items are explained below. Help Smallest Quit H or h ( for Help ) option will invoke a function named help() which will display a help screen. The help screen(s) should guide the user...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....
Program 7 Arrays: building and sorting (100 points) Due: Friday, October 30 by 11:59 PM Overview For this assignment, write a program that will calculate the quiz average for a student in the CSCI 240 course. The student's quiz information will be needed for later processing, so it will be stored in an array. For the assignment, declare one array that will hold a maximum of 12 integer elements (ie. the quiz scores). It is recommended that this program be...
Program 7 File Processing and Arrays (100 points) Overview: For this assignment, write a program that will process monthly sales data for a small company. The data will be used to calculate total sales for each month in a year. The monthly sales totals will be needed for later processing, so it will be stored in an array. Basic Logic for main() Note: all of the functions mentioned in this logic are described below. Declare an array of 12 float/doubles...