1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sleet_krkn [62]
3 years ago
15

Write a program that reads in non-negative integers and stores and displays distinct numbers (i.e., if a number appears multiple

times, it is stored and displayed only once). Your program should allow up to 1000 distinct numbers to be stored and displayed. Use the following algorithm (this is required!): Read each number and store it in an array if it is new. If the number is already in the array, ignore it. The user will indicate that they are done entering numbers by entering a negative number. Here is a sample run:
Enter a non-negative integer (negative to quit): 1
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): 3
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): 1
Enter a non-negative integer (negative to quit): 6
Enter a non-negative integer (negative to quit): 3
Enter a non-negative integer (negative to quit): 4
Enter a non-negative integer (negative to quit): 5
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): -4
You entered:
1 2 3 6 4 5
Computers and Technology
1 answer:
slavikrds [6]3 years ago
4 0

Answer:

See explaination

Explanation:

#include <iostream>

using namespace std;

#define MAX 1005

bool already_present(int data[MAX], int input, int size)

{

int i;

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

if(data[i] == input)

return true;

return false;

}

int read_stdin(int data[MAX])

{

int input;

int size=0;

while(true)

{

cout<<"Enter a non-negative integer (negative to quit): ";

cin>>input;

if(input<0)

break;

if(!already_present(data,input,size))

data[size++] = input;

}

return size;

}

void print_stdout(int data[MAX],int size)

{

int i;

cout<<"You entered\n";

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

cout<<data[i]<<" ";

cout<<endl;

}

int main()

{

int data[MAX],size;

size = read_stdin(data);

print_stdout(data,size);

return 1;

}

You might be interested in
How can you skillfully use the internet for research
elena-s [515]

By looking up your research on websites that have (.org) or wikipedia for answers u might have to find information

6 0
4 years ago
What is the purpose of concatenation?
bearhunter [10]

Explanation:

Concatenation allows you to add multiple strings together to form one long string by using the '+' operator between each string, so the purpose of concatenation is "<em>to combine two or more strings into one big string</em>" (third option).

Hope this helps :)

6 0
3 years ago
Create a Python program to solve a simple pay calculation.
Travka [436]

Answer:

def weeklyPaid(hours_worked, wage):  

   if hours_worked > 40:  

       return 40 * wage + (hours_worked - 40) * wage * 1.5

   else:  

       return hours_worked * wage  

 

 

hours_worked = 50

wage = 100

 

pay = weeklyPaid(hours_worked, wage)  

 

print(f"Total gross pay: Rs.{pay:.2f} ")

Explanation:

provides gross pay

6 0
3 years ago
Symbols can enhance your text. You can add mathematical or currency symbols, geometric shapes, and even smiley faces. Under whic
Sliva [168]
The answer is D. Hope this helped.
4 0
3 years ago
ven if you skipped all the requirements analysis steps, the two steps guaranteed to be completed in any software development are
makkiz [27]

Complete Question:

Even if you skipped all the requirements analysis steps, the two steps guaranteed to be completed in any software development are;

Group of answer choices

A. policy and procedure development

B. use case activity diagram testing

C. method design and coding

D. data conversion and user training

Answer:

C. method design and coding

Explanation:

A software development life cycle (SDLC) can be defined as a strategic process or methodology that defines the key steps or stages for creating and implementing high quality software applications. There are six (6) main stages in the creation of a software and these are;

1. Planning.

2. Analysis.

3. Design.

4. Development (coding).

5. Deployment.

6. Maintenance.

Among the listed stages, there are two (2) most important stages which cannot be ignored in the creation of a software application are.

<em>Hence, even if you skipped all the requirements analysis steps, the two steps guaranteed to be completed in any software development are method design and coding.</em>

I. Method design: this is the third step of the software development life cycle, it comes immediately after the analysis stage. This is the stage where the software developer describes the features, architecture and functions of the proposed solution in accordance with a standard.

II. Coding (development): this is the fourth step in the software development process and it involves the process of creating a source code which would enable the functionality of the software application.

3 0
3 years ago
Other questions:
  • Why were mechanical calculators developed?
    8·2 answers
  • What is the keyboard shortcut to display the merge to printer dialog box?
    5·1 answer
  • Explain briefly why every person in the world is not connected to the Internet.
    9·1 answer
  • A student is curious about how a Web site appears on his computer screen. On a piece of paper,
    9·1 answer
  • What is the term used to describe a computer system that can store literary documents, link them according to logical relationsh
    5·1 answer
  • Does coaxial cable use radio waves to transmit data
    10·2 answers
  • Identify the independent and dependent variable in the statement: the number of hours studying for a class and the grade earned.
    12·1 answer
  • Device driver:<br> System software or application software
    11·2 answers
  • The output for the following code will be: Pasta (1 mark)
    6·1 answer
  • Consider the following declaration:
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!