How to write a c program asking the user for 20 numbers in descending or ascending order, which then prompts the user to enter a number to search the array by using a binary search and print whether the number is found or not.
Please use a function for a bubble sort, a read, a print and a binaty search.​

Answers

Answer 1

#include <bits/stdc++.h>

#define ERR -1

std::vector<int> s;

int inp;

int eval(std::vector<int> v, int fl, int fr, int idx) {

   if (fr>=fl) {

       int idy = fl+(fr-fl)/2;

       if (v.at(idy)==idx) return idy;

       if (v.at(idy)>idx) return eval(v,fl,idy-1,idx);

       return eval(v,idy+1,fr,idx);

   }

   return ERR;

}

std::string print_result(int input) {

   int result = eval(s,0,s.size()-1,input);

   return result!=ERR ? "The element found at " + std::to_string(result) + ". index!\n" : "The element not found!\n";

}

void read() {

   std::cout << "Enter 20 numbers whether ascending or descending order.\n";

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

       std::cout << "\n>>";

       int fill; std::cin>>fill;

       s.push_back(fill);

   }

   std::cout << "Which element do you want to find?: ";

   std::cin>>inp;

}

int main(int argc, char* argv[]) {

   read();

   std::cout << print_result(inp);

   return 0;

}


Related Questions

1. It has been said that understanding our history can help us better prepare for our futurem
a notion that certainly applies to photography. Keeping this in mind, describe the
mechanics of early photographic systems, analyzing how they differ from the systems of
today and how understanding these past systems can help your craft.

Answers

The mechanics of early photographic systems began in France, with the invention of Joseph Nicéphore, who used a "dark camara" or Camara Obscura and a pewter plate in 1830. He coated the plate with bitumen. He exposed it to light in order to create a permanent image. Following the success of his experiment, he collaborated with French Louis Daguerre to develop the Daguerreotype, which used a copper plate with silver and a chemical called iodine. They exposed the image to light for about 15 minutes, and there you have it. The daguerreotype was a commercial success, and it served as a model for the next great invention, the emulsion plate.

Mechanics of early photograph:

One of the earliest photographic processes was wet collodion. Photographers made their own glass plates and coated them with a collodion (cellulose nitrate) and soluble iodide solution. The plate was then immersed in a silver nitrate solution in the darkroom.

Understanding the origins of photography and early systems reveals how inventive people were. That same creativity is required to create new designs and art concepts that will have an impact on future generations.

To learn more about mechanics of early photograph

https://brainly.com/question/18792950

#SPJ9

Data for each typeface style is stored in a separate file.
a. True
b. False

Answers

Data for each typeface style is stored in a separate: a. True.

What is a typeface?

In Computer technology, a typeface can be defined as a design of lettering or alphabets that typically include variations in the following elements:

SizeSlope (e.g. italic)Weight (e.g. bold)Width

Generally speaking, there are five (5) main classifications of typeface and these include the following:

SerifSans serifScriptMonospacedDisplay

As a general rule, each classifications of typeface has its data stored in a separate for easy access and retrieval.

Read more on typeface here: https://brainly.com/question/11216613

#SPJ1

many people are now using the web not simply to download content, but to build communities and upload and share content they have created. this trend has been given the name

Answers

The term "Web 1.0" describes the early development of the World Wide Web. In Web 1.0, the vast majority of users were content consumers and there were very few content creators.

Personal websites were widespread and mostly included static pages maintained on free web hosts or web servers controlled by ISPs.

Web 1.0 forbids the viewing of ads while browsing websites. Ofoto, another online digital photography websites from Web 1.0, allowed users to store, share, view, and print digital images. Web 1.0 is a content delivery network (CDN) that allows websites to present the information. One can use it as their own personal webpage.

The user is charged for each page they see. Users can access certain pieces of information from its directories. Web 1.0 was prevalent from around 1991 until 2004.

Four Web 1.0 design requirements are as follows:

1.static web pages

2.The server's file system is used to serve content.

3.Pages created with the Common Gateway Interface or Server Side Includes (CGI).

4.The items on a page are positioned and aligned using frames and tables.

To know more about Web 1.0 click on the link:

https://brainly.com/question/14411903

#SPJ4

Which type of footwear should be worn while working on hybrid electric vehicles (HEVs) and electric vehicles (EVs)

Answers

Answer: Insulated safety footwear.

Explanation: While working on a hybrid electric vehicle (HEV) or an electric vehicle (EV) you should wear Insulated safety footwear.

Cloud providers have virtually unlimited resources, which allows for

Answers

Cloud providers have virtually unlimited resources, which allows for scalability.

What is resource?

All materials available in our environment that are technologically accessible, economically possible, and culturally sustainable that assist us to satisfy our needs and desires are referred to as resources. They can also be characterised as actual or potential based on their level of development and use, as biotic or abiotic based on their origin, and as ubiquitous or localised based on their distribution. With the passage of time and the advancement of technology, an object becomes a resource.

Cloud scalability in cloud computing refers to the ability to scale up or scale down IT resources in response to changing demand. Scalability is a distinctive property of the cloud and a significant driver of its growing attractiveness among organisations.

To learn more about resource

https://brainly.com/question/24514288

#SPJ9

1. PP 2.1 Create a revised version of the Lincoln program from Chapter 1 to print the quotation
inside a box made up of character ^.
2. PP 2.2 Write a program that reads four integers and prints the sum of their squares.
3. PP 2.3 Write a program that reads three floating point numbers and prints the cube of their
average.
4. PP 2.7 Write a program that prompts for and reads integer values for typing speed and number
of characters in the document, then prints the time required to type them as a floating point
result.

Answers

The revised version of the Lincoln program from Chapter 1 to print the quotation us illustrate below.

What is a program?

A computer program is a set of instructions written in a programming language that a computer can execute. Software contains computer programs as well as documentation and other intangible components.

The program will be:

public class Print {

public static void main(String[] args)

{

char ch='"';

System.out.println("A quote by Abraham Lincoln:\n"+ch+"Whatever you are, be a good one."+ch);

//by using char for storing double quote

System.out.println("A quote by Abraham Lincoln:\n"+'"'+"Whatever you are, be a good one."+'"');

//in single quote

System.out.println("A quote by Abraham Lincoln:\n\"Whatever you are, be a good one.\"");

//using \"

}//end of main

}//end of Print class

/******OUTPUT*******

A quote by Abraham Lincoln:

"Whatever you are, be a good one."

A quote by Abraham Lincoln:

"Whatever you are, be a good one."

A quote by Abraham Lincoln:

"Whatever you are, be a good one."

*/

Learn more about programs on:

https://brainly.com/question/26568485

#SPJ1

5.Usage of sexual slurs, repeatedly pressurizing someone for a date, sharing provocative jokes and display of obscene pictures at workplace is considered as which form of sexual harassment
a. Hostile Work Environmaent
b. B.Quid pro quo
c. Both

Answers

Answer:

c. Both

Explanation:

Helppp pleaseee help pleaseee look at picture

Answers

Answer:

C & E

Explanation:

Brainlest, Please!

Answer:

C and E

Explanation:

Question # 2 Multiple Choice Do you think it is acceptable to copy and paste material from a web page into a term paper?
Yes, because information on the internet is free for everyone to use.
Yes, because information on the internet is free for everyone to use.
Yes, if you paste of where you got it from but do not quote it.
Yes, if you paste of where you got it from but do not quote it.
No, because you should not pass other people’s work off as your own.
No, because you should not pass other people’s work off as your own.
No, because you can get sued by the owner of the material.

Answers

Do you think it is acceptable to copy and paste material from a web page into a term paper: No, because you should not pass other people’s work off as your own.

What is plagiarism?

Plagiarism simply refers to an act of representing or using an author's literary work, thoughts, ideas, language, or expressions without their consent, permission, acknowledgement or authorization.

This ultimately implies that, plagiarism is an illegal act that involves using another author's intellectual work or copyrighted items word for word without getting an authorization and permission from the original author.

In this context, we can reasonably infer and logically deduce that it is very wrong to copy and paste material from a web source into a term paper without an accurate citation or reference to the original author.

Read more on plagiarism here: brainly.com/question/397668

#SPJ1

Answer:

C. No, because you should not pass other people’s work off as your own.

Explanation:

--------------------​

Answers

Answer:

Explanation:

answer below

How can you add a new printer to a print server within the Print Management tool using the default search option?​

Answers

To add a new printer to a print server within the Print Management tool using the default search option one can automatically find and install printers discovered on the server's local network, right-click ServerName (local) in the Print Management tree, then select Automatically Add Network Printers, and also then click Start.

What is software for print management?

By providing capabilities to more effectively monitor, regulate, as well as maintain their entire printer fleet from a single user interface, print management software enables enterprises to centralize administration and reduce the cost of printing.

Therefore, The Print Management Console snap-in, which is useful for controlling numerous printers or print servers and transferring printers to and from other Windows print servers, is included in the Print Server role, which is used to establish a Windows Print Server.

Learn more about Print Management from

https://brainly.com/question/27960904
#SPJ1

Write a program to display the s
tandard/deviation of 100 sets of numbers already stored in an array​

Answers

import random

import statistics

number = [1, 2, 3, 4, 5]

print("Standart deviation is: ", statistics.stdev(number))

Please edit the array before compiling the code.

Palindrome.java

Question:
Write an application that determines whether a phrase entered by the user is a palindrome. A palindrome is a phrase that reads the same backward and forward without regarding capitalization or punctuation. For example, “Dot saw I was Tod”, “Was it a car or a cat I saw”, and “Madam Im Adam” are palindromes. Display the appropriate feedback: You entered a palindrome or You did not enter a palindrome.

CODE:
import java.util.*;
public class Palindrome {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);
System.out.println("Enter phrase : ");
String phrase = sc.nextLine();
phrase = phrase.replace(" ", "").toLowerCase();
phrase = phrase.replaceAll("[^a-zA-Z0-9]", "");
int i = 0, j = phrase.length() - 1;
boolean ispalindrome= true;
while (i < j) {
if (phrase.charAt(i) != phrase.charAt(j)) {
ispalindrome = false;
}
i++;
j--;
}

if(ispalindrome)

{
System.out.println("you entered a palindrome.");
}
else
{
System.out.println("you did not enter a palindrome.");
}



}
}

RESULTS:

50% good

pls help

Answers

Ok, where is the phrase that we are trying to determine to see if it’s a palindrome. I can help you with this, I just need the provided phrase that was given with the question as well. All I see is transcripts below

9. Which of the following actions would NOT help identify your personal
ethics?
a. Describe yourself.
b. Conduct a genetic study of your extended family.
c. Identify the influences of your work environment.
d. Prepare a list of values that are most important to you.

Answers

Conduct a genetic study of your extended family would not help identify your personal ethics.

What is personal ethics?

Personal ethics refers to a person's morals and code of behaviour. These principles are instilled in a person by their parents, relatives, and friends from the time they are born. If there is no personal ethics, human existence is inadequate and superficial. It is the ethical standard by which a person makes decisions and acts in both personal and professional situations. These ethics affect many aspects of a person's life and help to develop a person's work ethic, personal and professional objectives, and values. Individuals use ethics to determine what is right and wrong and to influence how others act in difficult situations.

The primary ethical concerns that IRBs and investigators must grapple with when designing and reviewing studies involving the use of genetic information are privacy, confidentiality, informed consent, and return of results.

So, B is correct answer.

To learn more about Personal ethics

https://brainly.com/question/1031443

#SPJ9

Question 2 (1 point)
In a worksheet, the vertical spaces with headings A, B, C, and so on.
columns
cells
rows
labels

Answers

In a worksheet, the vertical spaces with headings A, B, C, are columns.

What do you mean by worksheet?

Spreadsheet software in computing displays a user interface on a computer monitor that resembles one or more paper accounting worksheets. A single spreadsheet (more formally, a two-dimensional matrix or array) is referred to as a worksheet in Microsoft Excel, while a collection of worksheets is referred to as a workbook.

A column in a spreadsheet is defined as the vertical space that runs up and down the window. Each column's location is denoted by a letter.

So, A is the right answer.

To learn more about worksheet

https://brainly.com/question/25130975

#SPJ13

bob is sending a message to alice. he wants to ensure that nobody tampers with the message while it is in transit. what goal of cryptography is bob attempting to achieve?

Answers

He wants to make certain that the communication through message is not tampered with while in transit. The integrity of cryptography is bob attempting to achieve.

What do you mean by message?

A message is a distinct unit of communication intended for consumption by some recipient or set of recipients by the source. A message can be conveyed via courier, telegraphy, carrier pigeon, or electronic bus, among other methods. A broadcast's content can be a message. A conversation is formed through an interactive exchange of messages. A press release is an example of a communication, which can range from a brief report or statement issued by a government body to commercial publicity material.

To learn more about message

https://brainly.com/question/25660340

#SPJ13

Variance for accumulator. Validate that the following code, which adds the
methods var() and stddev() to Accumulator, computes both the mean and variance
of the numbers presented as arguments to addDataValue():
public class Accumulator
{
private double m;
private double s;
private int N;
public void addDataValue(double x)
{
N++;
s = s + 1.0 * (N-1) / N * (x - m) * (x - m);
m = m + (x - m) / N;
}
public double mean(

Answers

Using the knowledge of computational language in JAVA it is possible to write a code that Validate that the following code, which adds the methods var() and stddev() to Accumulator, computes both the mean and variance of the numbers presented as arguments to addDataValue()

Writting the code:

import java.util.*;

public class Accumulator {  

private static double m;  

private static double v;  

private static double st;  

private static  double s[]=new double[5];

private static int N;

private static int count =0;

public static void main(String[] args) {

// TODO Auto-generated method stub

Random r = new Random();

System.out.println("hello world");

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

   double randomvalue = r.nextDouble();

addDataValue(randomvalue);

}

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

   System.out.println("dataValue:"+s[i]);

}  

mean();

System.out.println("mean:"+m);

var();

System.out.println("variance:"+v);

stddev();

System.out.println("standard deviation:"+st);

}

public  static void addDataValue(double value) {     // addes data values to array

 s[count]=value;

 count++;

}

public static double mean() {        // returns mean

double sum=0.0;

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

   sum+=s[i];

}

m = sum/s.length;

return m;

}  

public static double var() {    //returns variance

double mm = mean();

    double t = 0;

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

        t+= (s[i]-mm)*(s[i]-mm);

}

    v= t/(s.length-1);

     return v;  

}

public static  double stddev() {        // returnsn the stardard deviation

st= Math.sqrt(var());

return st;

}

}

See more about JAVA at brainly.com/question/12975450

#SPJ1

I don't know who to do this assignment
An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours plus any overtime pay. Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage. Write a program that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay.

Answers

Python:

wage=int(input("What the hourly wage?: "))

total_reg_hours=int(input("Enter total regular hours: "))

total_over_hours=int(input("Enter total overtime hours: "))

#Calculate the weekly pay.

print("The weekly pay of this employee is ",(total_reg_hours*wage)+(total_over_hours*(1.5*wage)))

C++:

#include <iostream>

int main(int argc, char* argv[]) {

   int wage,t_reg,t_over;

   std::cout << "Enter wage: "; std::cin>>wage;

   std::cout << "\nEnter total regular hours: "; std::cin>>t_reg;

   std::cout << "\nEnter total overtime hours: "; std::cin>>t_over;

   

   //Calculate the weekly pay.

   std::cout << "The weekly pay of this employee is " << (t_reg*wage)+(t_over*1.5*wage) << std::endl;

   return 0;

}

The main issues covered by IT law are: Hardware licensing Data privacy Department security True False

Answers

The main issues covered by IT law are: Hardware licensing, Data privacy, Department security is a true statement.

What topics are addressed by cyber law?

There are three main types of cyberlaw:

Human-targeted crimes (e.g.: harassment, stalking, identity theft) Vandalism of property (e.g.: DDOS attacks, hacking, copyright infringement) The theft from the govt (e.g.: hacking, cyber terrorism)

Cyber law includes provisions for intellectual property, contracts, jurisdiction, data protection regulations, privacy, and freedom of expression. It regulates the online dissemination of software, knowledge, online safety, and e-commerce.

Note that some Internet security issues that must be considered are:

Ransomware Attacks. IoT Attacks. Cloud Attacks. Phishing Attacks.Software Vulnerabilities, etc.

Learn more about IT law from

https://brainly.com/question/9928756
#SPJ1  

Write a pseudocode algorithm to accept two values in variables num1 and num2. if num1 is greater that num2 subtract num2 from num1and multiply the result by itself If num2 is greater than num1 multiply num1 by num2 Print the numbers that were entered and the result of either scenarios​

Answers

The required Pseudocode Algorithm of the given question are:

Set num1 and num2 equal to user inputIf num1 is greater than num2Subtract num2 from num1Multiply result by itselfIf num2 is greater than num1Multiply num1 by num2Print num1, num2, and result

What is algorithm?

An algorithm in computer science is a finite sequence of rigorous instructions that is typically used to solve a class of specific problems or to perform a computation. Algorithms serve as specifications for calculating and processing data. Advanced algorithms can perform automated deductions and then use mathematical and logical tests to route code execution through different paths.

To learn more about algorithm

https://brainly.com/question/24953880

#SPJ9

Pregunta Shapes are located on the ______ Tab in PowerPoint.​

Answers

Answer: its located in the insert tab

you receive an email from your organization notifying you that you need to click on a link and enter some personal information to verify your identity or else your account will be suspended. what should you do?

Answers

You should reach out to your organization to confirm that the email is legitimate before taking any action. If you are unsure, you can also try to look up the organization's contact information online to verify.

What is email?

Electronic mail (often known as e-mail) is a technique of transmitting messages ("mail") between persons via electronic equipment. Email was thus envisioned as the electronic (digital) alternative to mail at a period when "mail" solely referred to physical mail (thus e- + mail). Email later became a ubiquitous (extremely extensively used) communication channel, to the point where an email account is often viewed as a basic and necessary aspect of many procedures in most nations, including business, trade, government, education, entertainment, and other realms of daily life.

To learn more about email

https://brainly.com/question/24688558

#SPJ4

I would like to create crossword puzzles in Java. Two 4X4 and two 6X6 puzzles. How do I go about it?

Answers

One of the ways to create crossword puzzles in Java using GUI is given below:

The Program

import java.awt.BorderLayout;

import java.awt.FlowLayout;

import java.awt.GridLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.util.Random;

The program is attached in the file below as the profanity counter is rejecting the code here, so I cannot post it here.

Read more about java programming here:

https://brainly.com/question/18554491

#SPJ1

hr has just informed you that jessica jones has recently gotten married and changes her name to jessica smith. she has requested that her jjones username be changed to jsmith. what command would accomplish this?

Answers

The command to accomplish this would be: usermod -l jsmith jjones.

What is command?

A command in computing is a request to a computer programme to complete a specified task. It can be issued using a command-line interface, such as a shell, as input to a network service as part of a network protocol, or as an event in a graphical user interface triggered by the user picking an item from a menu. The term command is used specifically in imperative computer languages. The name comes from the fact that sentences in these languages are typically written in an imperative mood, which is common in many natural languages.

To learn more about command

https://brainly.com/question/27986533

#SPJ4

Which of the following Windows tools can be used to manage group information?

Answers

Active Directory Users and Computers is the Windows tools can be used to manage group information.

What is Active Directory used for?

Administrators and users can easily locate and use the information that Active Directory holds about network objects. Active Directory organizes directory data logically and hierarchically on the basis of a structured data store.

To access Active Directory Users and Computers, choose Start > Administrative Tools.Locate and pick your domain name from the Active Directory Users and Computers tree.To navigate your Active Directory hierarchy, expand the tree.

Therefore, You may manage user and computer accounts, groups, printers, organizational units (OUs), contacts, and other Active Directory objects with Active Directory Users and Computers. You can create, delete, alter, move, arrange, as well as set rights on these items with this tool.

Hence, option C is correct.

Learn more about Active Directory Users from

https://brainly.com/question/24215126
#SPJ1

See option below

Local Users and Groups

o  User Accounts

o  Active Directory Users and Computers

o  User and Group Management

I really need help with this what are 4 things that show you this email is a scam

Answers

Answer:

1. Grammar errors and misspelled words.

Example: if no action is "taking" we will be "force"

Correct words are supposed to be taken and forced.

2. Name of sender "Email_Service" The underscore brings a little suspicion and it doesn't match the name of the email its being sent from.

3. Urgency. In other words this is an "ACT NOW, ACTION REQUIRED" email, which normally come from scams.

4. Threats – LAST WARNING,  IF NO ACTION IS TAKEN YOUR EMAIL WILL BE BLACKLISTED.

Explanation:

The US Centers for Disease Control and Prevention (CDC) said in a statement on October 22 local time that the director of the agency, Wollensky, tested positive for COVID-19 on the evening of the 21st and had mild symptoms. Wolenski has been vaccinated with the latest COVID-19 vaccine, and is currently isolated at home and will participate in the meeting online.

Answers

The director of the Centers for Disease Control and Prevention and the administrator of the Agency for Toxic Substances and Disease Registry, Rochelle Paula Walensky, is an American physician and scientist.

How long after taking Covid may you test positive?

You might continue to test positively for a while after receiving a positive test result. After your initial positive result, you can test positive for antigens for a few weeks. NAAT results can remain positive for up to 90 days.

CDC works around-the-clock to safeguard America from threats to its health, safety, and security, both domestically and abroad.

The CDC battles disease whether it originates domestically or overseas, whether it is acute or chronic, curable or preventable, caused by human error or malicious attack and encourages residents and communities to do the same.

To learn more about Covid-19 refer to:

https://brainly.com/question/28347122

#SPJ1

Answer:

Explanation:

Answer:

The director of the Centers for Disease Control and Prevention and the administrator of the Agency for Toxic Substances and Disease Registry, Rochelle Paula Walensky, is an American physician and scientist.

What is Covid-19?

Different people are affected by COVID-19 in various ways. The majority of infected individuals will experience mild to moderate sickness and recover without being hospitalized.

Most typical signs:

fever \scough \stiredness

loss of scent or taste.

Less frequent signs:

throat infection headache aches and discomfort

diarrhea, a skin rash, discoloration of the fingers or toes, or red or itchy eyes.

To learn more about covid-19 refer to the:

https://brainly.in/question/49728785

#SPJ1

Chris is unfamiliar with the word processing program he is using. He wants to find
the drop-down text-driven options for the document view because he does not yet
recognize the icons at the top of the window. Where can Chris find these drop down
options?

Answers

Since Chris wants to find the drop-down text-driven options for the document view because he does not yet recognize the icons at the top of the window. The place that Chris can  find these drop down options is option D: Menu bar.

What does a computer menu bar do?

The area of a browser or application window known as the menu bar, which is normally found at the upper left corner, contains drop-down menus that let users interact with the application or content in a variety of ways.

Therefore, while menu bars list all of a program's top-level commands, toolbars only display the most commonly used commands. Immediacy. A menu command could require additional input, but clicking a toolbar command has an immediate impact.

Learn more about Menu bar from

https://brainly.com/question/20380901


#SPJ1

See full question below

Chris is unfamiliar with the word processing program he is using. He wants to find the drop-down text-driven options for the document view because he does not yet recognize the icons at the top of the window. Where can Chris find these drop down options?

answer choices

Options bar

Scroll bar

Toolbar

Menu bar

You have found a file named FunAppx86.exe on your hard drive. Which system(s) would this executable file MOST likely run on?

Answers

Since you have found a file named FunAppx86.exe on your hard drive, the systems that this executable file MOST likely run on is Both 32-bit and 64-bit systems.

What does 32- and 64-Bit Mean?

When it comes to computers, the processing capability differential between a 32-bit and a 64-bit is everything. 64-bit processors are newer, quicker, and more secure than 32-bit processors, which are older, slower, and less secure.

Therefore, A computer file that contains an encoded sequence of instructions that the system can directly execute when the user clicks the file icon," is the definition of an executable file.

Learn more about executable file from

https://brainly.com/question/28146265
#SPJ1

Consider the following program segment:

//include statement(s)
//using namespace statement

int main()
{
//variable declaration
//executable statements
//return statement
}


Write C++ statements that include the header files iostream and string.

Write a C++ statement that allows you to use cin, cout, and endl without the prefix std::.

Write C++ statements that declare and initialize the following named constants: SECRET of type int initialized to 11 and RATE of type double initialized to 12.50.

Write C++ statements that declare the following variables: num1, num2, and newNum of type int; name of type string; and hoursWorked and wages of type double.

Write C++ statements that prompt the user to input two integers and store the first number in num1 and the second number in num2.

Write a C++ statement(s) that outputs the values of num1 and num2, indicating which is num1 and which is num2. For example, if num1 is 8 and num2 is 5, then the output is:

The value of num1 = 8 and the value of num2 = 5.
Write a C++ statement that multiplies the value of num1 by 2, adds the value of num2 to it, and then stores the result in newNum. Then, write a C++ statement that outputs the value of newNum.

Write a C++ statement that updates the value of newNum by adding the value of the named constant SECRET to it. Then, write a C++ statement that outputs the value of newNum with an appropriate message.

Write C++ statements that prompt the user to enter a person’s last name and then store the last name into the variable name.

Write C++ statements that prompt the user to enter a decimal number between 0 and 70 and then store the number entered into hoursWorked.

Write a C++ statement that multiplies the value of the named constant RATE with the value of hoursWorked and then stores the result into the variable wages.

Write C++ statements that produce the following output:

Name: //output the vlaue of the variable name
Pay Rate: $ //output the value of the Rate
Hours Worked: //output the value of the variable hoursWorked
Salary: $ //output the value of the variable wages
For example, if the value of name is "Rainbow" and hoursWorked is 45.50, then the output is:

Name: Rainbow
Pay Rate: $12.50
Hours Worked: 45.50
Salary: $568.75
Write a C++ program that tests each of the C++ statements that you wrote in parts a through l. Place the statements at the appropriate place in the C++ program segment given at the beginning of this problem. Test run your program (twice) on the following input data:

a.
num1 = 13, num2 = 28; name ="Jacobson"; hoursWorked = 48.30.


b.
num1 = 32, num2 = 15; name ="Crawford"; hoursWorked = 58.45.

Answers

The program will be illustrated thus:

c++ code:

#include <iostream>

using namespace std;

int main() {

string s;

cout<<"Enter your name : "<<endl;

cin>>s;

int num1,num2,num3,average;

num1=125;

num2=28;

num3=-25;

average=(num1+num2+num3)/3;

cout<<"num1 value is : "<<num1<<endl;

cout<<"num2 value is : "<<num2<<endl;

cout<<"num3 value is : "<<num3<<endl;

cout<<"average is : "<<average<<endl;

return 0;

What is a program?

A program is a precise set of ordered operations that a computer can undertake. The program in the modern computer described by John von Neumann in 1945 has a one-at-a-time series of instructions that the computer follows. Typically, the software is saved in a location accessible to the computer.

Computer programs include Microsoft Word, Microsoft Excel, Adobe Photoshop, Internet Explorer, Chrome, and others. In filmmaking, computer applications are utilized to create images and special effects.

Learn more about Program on:

https://brainly.com/question/23275071

#SPJ1

Other Questions
select all that apply an unfavorable labor efficiency variance can result from blank . multiple select question. insufficient product demand the payment of overtime premiums faulty equipment poorly motivated workers If 340 grams of a substance are present initially and 50 years later only 170 grams remain, how much of the substance will be present after 120 years?Round to the nearest tenth of a graim.grams Salesman A gets paid $300 a month plus $8 for every sale he makes. Salesman B gets paid $1500 a mont. Write and equation and solve to see how many salesman a must make in order to make the same amount of salesman b Find the y intercept: y=3.5x-7 A taxi service charges $3 for the first mile and then $2.25 for every mile after that. The farthest the taxi will travel is 35 miles. If X represents the number of miles traveled, and Y represents the total cost of the taxi ride, what is the most appropriate domain for the solutions? Find the volume of each rectangular prism. Round to the tenths. a 68.1-kg boy is surfing and catches a wave which gives him an initial speed of 1.60 m/s. he then drops through a height of 1.56 m, and ends with a speed of 8.51 m/s. how much nonconservative work (in kj) was done on the boy? Write about a business management theory that you identify with, incorporating real life examples in your answer.Note - Minimum word requirement is 200 words In one or two paragraphs, explain why you think the caste system still has an influence in India today what is the absolute value for this equation? : |-x| = 3 Why did the United States want new materials Solve the inequality and write the solution using:Inequality Notation: Quinton will flip a coin and roll a die.What is the probability that he will flip "tails" and roll a "2 Look at the expression below.2h + y 4h^2_______ - _____9h^2-y^2 3h+yWhich of the following is the least common denominator for the expression? Each of the letters a through H has one of the 8 values listed. no 2 letters have the same value. The Simple arithmetic problems are clues for determining the value of each letter. Simply guess and check to find the values for letters a through H. You must use numbers listed below. The list price of an air conditioner is $ 1260. The store offers an off season discount of 16% on it. Find its selling price. Two freight trains are delivering cargo. One freight train is delivering coal, and the other freight train is delivering grain. Their respective distances traveled after x hours is represented in the table and graph below. frances is a photographer who lived back in 1839 and enjoyed the popularity of the daguerreotype photographic process. he had a client who requested two copies of a portrait photograph that frances was taking. what did frances likely have to do to accomplish this? the decrease in the fluency and productivity of speech that is seen in schizophrenia is specifically termed: a. catatonia. b. alogia. c. blocking. d. avolition. an ice has a volume of 8975 ft^3. what is the mass in kilograms of the iceberg? the density of ice 0.917 g/cm^3