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
Natali5045456 [20]
2 years ago
13

Assume you have a int variable n that has already been declared and initialized. Its value is the number of integers that need t

o be read in from standard input and printed out in sorted (ascending) order, each on a line by itself. Furthermore, there are no duplicates in the input and every number to be read is a non-negative value that is less than n's value. In this exercise you may not use any array (or fancy STL collection such as a vector). You may declare a variable or two as needed. With these restrictions, read the n values and print them out as required onto standard output.
Computers and Technology
1 answer:
Aleks [24]2 years ago
5 0

Answer:

/*This program is in c++*/

# include<iostream>

#include<stdio.h>

using namespace:; std;

int main()

{

 int n, a[20]; /* n can be maximum 20*/

 cout<<"Enter the value of n";

 cin>>n;

 For (int i=0;i<=n;i++)

{

  cout<<"The number must be less than"<<n;

  cin>>a[i];

}

int k=a[0];

for(int j=0;j<=n;j++)

{

   if(a[i]<k)

     {  

          a[i];=k

         k=a[i];

     }

     else

     {

          continue;

      }

}

cout<<"The numbers in ascending order are:";

for{int m=0;i<=n;i++)

{

    cout<<"a[i];

}

return 0;

}

         

Explanation:

The program is self explanatory.

You might be interested in
You have been asked to implement a data integrity program to protect data files that need to be electronically downloaded by the
Katyanochek1 [597]

Answer:

SHA-1 is used in this case.

Explanation:

7 0
3 years ago
Suppose that the content of the input file is: 14 13 26 8 -11 36 0 -1. What is the output of the following code? ifstream myInfi
tester [92]
I do not know, i really hope you dont fail!!!!!!!!!
3 0
3 years ago
Read 2 more answers
Write a method that accepts a String object as an argument and returns a copy of the string with the first character of each sen
emmainna [20.7K]

Answer:

The programming language is not stated; However, the program written in C++ is as follows: (See Attachment)

#include<iostream>

using namespace std;

string capt(string result)

{

result[0] = toupper(result[0]);

for(int i =0;i<result.length();i++){

 if(result[i]=='.' || result[i]=='?' ||result[i]=='!')  {

 if(result[i+1]==' ') {

  result[i+2] = toupper(result[i+2]);

 }

 if(result[i+2]==' ')  {

  result[i+3] = toupper(result[i+3]);

 }

 } }

return result;

}

int main(){

string sentence;

getline(cin,sentence);

cout<<capt(sentence);

return 0;

}

Explanation:

<em>The method to capitalize first letters of string starts here</em>

string capt(string result){

<em>This line capitalizes the first letter of the sentence</em>

result[0] = toupper(result[0]);

<em>This iteration iterates through each letter of the input sentence</em>

for(int i =0;i<result.length();i++){

This checks if the current character is a period (.), a question mark (?) or an exclamation mark (!)

if(result[i]=='.' || result[i]=='?' ||result[i]=='!')  {

 if(result[i+1]==' '){  ->This condition checks if the sentence is single spaced

  result[i+2] = toupper(result[i+2]);

-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized

 }

 if(result[i+2]==' '){ ->This condition checks if the sentence is double spaced

  result[i+3] = toupper(result[i+3]);

-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized

 }

}

}  <em>The iteration ends here</em>

return result;  ->The new string is returned here.

}

The main method starts here

int main(){

This declares a string variable named sentence

string sentence;

This gets the user input

getline(cin,sentence);

This passes the input string to the method defined above

cout<<capt(sentence);

return 0;

}

Download cpp
7 0
3 years ago
Which of the following is the ribbon path to the cell styles button? (home tab | styles group) (styles tab | home group) (home t
Alekssandra [29.7K]
I guess you talk about Excel. I'm pretty sure that that the path to the cell styles button looks like this <span>home tab | styles group. It's the most common pass. But in other cases, it depends on the software you use.</span>
5 0
3 years ago
Select the correct answer.
patriot [66]
C spamming because he didn’t sign up for the emails
4 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is an example of subjunctive verb mood?
    5·1 answer
  • A computer has a word length of 8 bits (including sign). if 2’s complement is used to represent negative numbers, what range of
    5·1 answer
  • Difference between a software package and Integrated software and why users would choose one over the other
    8·1 answer
  • What does IDLE stand for
    11·2 answers
  • I get brainlist to whoever can help my computer is doing this and I have class and it’s not working and I got it wet yesterday b
    12·2 answers
  • Hannah wants to write a book about how scientists and society interact, and she has generated ideas for chapters. Which chapter
    13·1 answer
  • Después de un incidente de seguridad del cliente, el equipo realiza un análisis en profundidad de cada paso dado por los atacant
    6·1 answer
  • What is used to accurately position objects on the slide using a single horizontal and vertical line that intersects in the cent
    12·2 answers
  • Which excel feature makes it easy to copy and paste formulas in multiple cells?.
    7·1 answer
  • Which instruction is used to convert an integer value to float and push it onto the fpu stack?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!