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
Nonamiya [84]
3 years ago
7

Suppose that you have the following declaration:

Computers and Technology
1 answer:
masha68 [24]3 years ago
6 0

Answer:

Explanation:

The code is written in C++:

#include <iostream>

#include <stack>

#include <math.h>

#include <iomanip>

using namespace std;

/*

* Supporting method to print contents of a stack.

*/

void print(stack<double> &s)

{

if(s.empty())

{

cout << endl;

return;

}

double x= s.top();

s.pop();

print(s);

s.push(x);

cout << x << " ";

}

int main(){

// Declaration of the stack variable

stack<double> stack;

//rray with input values

double inputs[] = {25,64,-3,6.25,36,-4.5,86,14,-12,9};

/*

* For each element in the input, if it is positive push the square root into stack

* otherwise push the square into the stack

*/

for(int i=0;i<10;i++){

if(inputs[i]>=0){

stack.push(sqrt(inputs[i]));

}else{

stack.push(pow(inputs[i],2));

}

}

//Print thye content of the stack

print(stack);

}

OUTPUT:

5     8     9     2.5     6     20.25     9.27362     3.74166     144     3

-------------------------------------------------------------------------

Process exited after 0.01643 seconds with return value 0

Press any key to continue . . . -

You might be interested in
A data structure used to bind an authenticated individual to a public key is the definition of ________.
patriot [66]

Answer:

Digital Certificate is the correct answer of this question.

Explanation:

Digital certificates are always for encryption and identification for transmitting public keys.The concept of digital certificate is a data structure used for linking an authenticated person to a public key. It is used to cryptographically attach public key rights to the organization that controls it.

<u>For example</u>:- Verisign, Entrust, etc.

  • An appendix to an electronic document that is used for authentication purposes.
  • A digital certificate's most frequent use is to confirm that an user sending a message is who he or she appears to be, and provide the recipient with the means to encode a response.

4 0
3 years ago
How is knowing how to use word or docs importamt?
ollegr [7]
For 90% of users, the word processing capabilities of Google Docs is more than enough. But for some, Microsoft Word's advanced features will be important. ... You also get far more powerful templates, which could speed up your work, depending on what you use Word for.
3 0
3 years ago
Consider the security of a mobile device you use
Alekssandra [29.7K]

Answer:

keep it private

Explanation:

7 0
3 years ago
Why can’t I see one individual’s questions in the app through their profile, but I can see their questions on the website?
Mumz [18]

Answer:

I think thats just a software issue. i have the same problem

Explanation:

7 0
3 years ago
Read 2 more answers
Write a fragment of code that will test whether an integer variable score contains a valid test score. Valid test scores are in
Klio2033 [76]

Answer:

Following are the code in the C Programming Language.

//set integer datatype variable

int score;

//check condition is the score is in the range of 0 to 100

if(score > 0 && score < 100){

//print if condition is true

printf("Valid test scores");

}else{

//otherwise print the following string.

printf("test scores are Invalid");

}

Explanation:

<u>Following are the description of the code.</u>

In the following code that is written in the C Programming Language.

  • Set an integer data type variable i.e., score.
  • Then, set the if conditional statement to check the condition is the variable "score" is greater than 0 and less the 100.
  • If the following statement is true then print "Valid test scores".
  • Otherwise, it print "test scores are Invalid".
5 0
3 years ago
Other questions:
  • One of the major advantages of digital photography is the ability to see the shot as soon as you take it.
    13·1 answer
  • The mutt software is an example of what type of mail service software on Linux? a. Mail Delivery Agent b. Mail Transport Agent c
    5·1 answer
  • How do you increase the amount of data in a sampled Google Analytics report?
    8·1 answer
  • Chevening is looking for individuals with strong professional relationship building skills, who will engage with the Chevening c
    15·1 answer
  • Given a String variable response that has already been declared, write some code that repeatedly reads a value from standard inp
    10·1 answer
  • Tell me at list 5 farm animals dieases​
    10·2 answers
  • If your internet were to go out, what steps would you take to troubleshoot to restore your service?
    15·1 answer
  • Advantages of Linux include_____.
    6·1 answer
  • There is a file of a few Sean Connery movies on the internet. Each entry has the following form:
    9·1 answer
  • I need help!!!! 1.04
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!