Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
100%

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 <iostream>
#define TRUE 0
#define FALSE 1

using namespace std;

int main()
{
//Declaration of array
int A[50];

//Display the first element of the array A
cout << "The value of the first element of the array A is: " << A[0] << endl;

//Store the value 26 in 25th element of array A
A[24] = 26;

//Store the computed value in 10th element of array A
A[9] = (A[39] * 3) + 10;
cout << "The value of the 10th element of the array A is: " << A[9] << endl;

int n = 0; //Subscript of array A

//For loop
for (int i = 0; i < n; i++)
{
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 A
}

if (n / 2 != 0 || n / 3 != 0) //If subscript is not a multiple of 2 or 3
break; //Break out of loop
}

//End of program
return 0;
}

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
expand button
Transcribed Image 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
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education