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
lesantik [10]
3 years ago
9

Write a program that continually prompts the user for an integer input until input is entered that is less than 0. Each input th

at is accepted is appended to an array named inputs, until an invalid input is given. When the first invalid input is entered the program prints the array and exists.
Computers and Technology
1 answer:
professor190 [17]3 years ago
7 0

Answer:

Following are the program in the C++ Programming Language:

#include <iostream>//header file

using namespace std;//namespane

//set main method

int main() {  

int a[100]; //set integer type array variable

int value, i = 0; //set integer variables

cout<<"Enter less than 0 to exit:"<<endl; //message for exit

cout<<"Enter the integer numbers:"<<endl; //message to enter numbers

do{ //set do while

cin>>value; //get input from the user

a[i++] = value; //append elements in array

}while(value>=0);

i--;  

cout<<"\nArray are:"<<endl;//message for array

for(int k = 0;k<i;k++){ //set for loop

cout<<a[k]<<" "; //print array

}

return 0;

}

<u>Output</u>:

Enter less than 0 to exit:

Enter the integer numbers:

1

2

3

4

5

-1

Array are:

1 2 3 4 5

Explanation:

Here, we set the integer data type main method "main()" and inside it:

  • we set integer type array variable with index value 100.
  • we set two integer type variable "value" and "i" initialize value 0.
  • we set the do-while loop in which we get the input from the user and and append in the array and pass condition if the value is greater then equal to 0.
  • Finally, set for loop and print the elements of an array.

 

You might be interested in
As an experienced networking professional, you are asked to conduct a posture assessment on a local credit union’s network. The
ale4655 [162]

Answer:1987

Explanation:guess

8 0
3 years ago
What is the correct way to set an unordered list to use squares for its list item symbols?
Sindrei [870]

Answer:To create unordered list in HTML, use the <ul> tag. The unordered list starts with the <ul> tag. The list item starts with the <li> tag and will be marked as disc, square, circle, etc. The default is bullets, which is small black circles.

Explanation:sorry if it’s wrong

5 0
2 years ago
Rint "Censored" if userInput contains the word "darn", else print userInput. End with newline.
Marta_Voda [28]

If you're coding with C++ then the solution would be:

  if (userInput.find("darn") != -1) {

     cout << "Censored" << endl;

  }

  else{

     cout << userInput << endl;

  }

Keep in mind that this will reject any input with the word "darn" in the sentence. This will not filter the word darn if the capitalization is in different formats like "Darn, dArn, daRn, darN, DARN".

7 0
3 years ago
How are charts inserted into a PowerPoint slide?
atroni [7]
It’s the third one.
7 0
3 years ago
Read 2 more answers
Tone is created using
Igoryamba

Answer:

diction and syntax.

Explanation:

4 0
2 years ago
Other questions:
  • Which major and minor keys have no sharps or flats apex?
    5·2 answers
  • What cable should i be using to connect my android tablet to the pc?
    13·2 answers
  • The memory unit of a computer has 2M Words of 32 bits (or 4 bytes) each. The computer has an instruction format with 4 fields: a
    14·1 answer
  • Write a SELECT statement that returns three columns: EmailAddress, OrderID, and the order total for each customer. To do this, y
    14·1 answer
  • Briefly describe the fundamental differences between project-based and product-based Software Engineering.
    10·1 answer
  • If Laura wanted to solve a problem using recursion where the last statement executed is the call to the same method, what type o
    8·1 answer
  • Explain the different type of shift register counter ​
    14·1 answer
  • HELPPP
    5·1 answer
  • If you enter the search "genetically modified foods" in a database, the double quotes around the three words will:
    11·1 answer
  • What is System Testing
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!