This is my C++ Codes for the problem but it has errors when I run it. Can you fix the errors? Please still use header files iostream. This is a topic under Data Structures: Arrays.
//Start of program#include #define TRUE 0#define FALSE 1using namespace std;int main(){//Declaration of arrayint A[50];//Display the first element of the array Acout < "the="" value="" of="" the="" first="" element="" of="" the="" array="" a="" is:="" "="">< a[0]=""><>//Store the value 26 in 25th element of array AA[24] = 26;//Store the computed value in 10th element of array AA[9] = (A[39] * 3) + 10;cout < "the="" value="" of="" the="" 10th="" element="" of="" the="" array="" a="" is:="" "="">< a[9]=""><>int n = 0; //Subscript of array A//For loopfor (int i = 0; i < n;="">{if (n / 2 == 0 || n / 3 == 0) //If subscript is a multiple of 2 or 3{cout < a[i]="">< "="" "="">< endl;="" display="" the="" value="" of="" an="" element="" of="" array="">}if (n / 2 != 0 || n / 3 != 0) //If subscript is not a multiple of 2 or 3break; //Break out of loop}//End of programreturn 0;}Extracted text: Write a program that will read in N integers from keyboard input into an array. The size of the array N will be entered on the keyboard. The program will tabulate the output as shown below: the first column should show the list of distinct array elements sorted in ascending order, while the second column should show the number of occurrences of each element. Sample input: 9, 15, 7, 9, 3, 7, 3, 3,7, 6, 3, 20 Expected output: count 3. 4 6 1 7 3 15 1 20 1
using namespace std;
int main(){//Declaration of arrayint A[50];
//Display the first element of the array Acout < "the="" value="" of="" the="" first="" element="" of="" the="" array="" a="" is:="" "="">< a[0]=""><>
//Store the value 26 in 25th element of array AA[24] = 26;
//Store the computed value in 10th element of array AA[9] = (A[39] * 3) + 10;cout < "the="" value="" of="" the="" 10th="" element="" of="" the="" array="" a="" is:="" "="">< a[9]=""><>
int n = 0; //Subscript of array A
//For loopfor (int i = 0; i < n;="">{if (n / 2 == 0 || n / 3 == 0) //If subscript is a multiple of 2 or 3{cout < a[i]="">< "="" "="">< endl;="" display="" the="" value="" of="" an="" element="" of="" array="">}
if (n / 2 != 0 || n / 3 != 0) //If subscript is not a multiple of 2 or 3break; //Break out of loop}//End of programreturn 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here