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
vova2212 [387]
3 years ago
9

Consider the following program segment: //include statement(s) //using namespace statement int main() { //variable declaration /

/executable statements //return statement }
a) Write C11 statements that include the header files iostream and string.
b) Write a C11 statement that allows you to use cin, cout, and endl without the prefix std::.
c) Write C11 statements that declare the following variables: name of type string and studyHours of type double.
d) Write C11 statements that prompt and input a string into name and a double value into studyHours.
Computers and Technology
1 answer:
nordsb [41]3 years ago
4 0

Answer:

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

#include <iostream>

#include <string>

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

To use cin and cout, one must first declare at least one variable. At this point, I'll assume that the variable has been declared already I'll name my variable "test" without the quotes.

cin>>test;

cout<<test<<endl;

c. Write C++ statements that declare the following variables: name of type string and studyHours of type double.

string name;

double studyHours;

d. Write C++ statements that prompt and input a string into name and a double value into studyHours.

string name;

double studyHours;

cout>>"What's your name?";

cin<<name;

cout<<"What's your study hours?";

cin>> studyHours;

PS: A full program in C++ that illustrates the above

#include <iostream>

#include <string>

using namespace std

int main()

{

string name;

double studyHours;

cout>>"What's your name?";

cin<<name;

cout<<"What's your study hours?";

cin>> studyHours;

cout<<"Hello "<<name<<", your study hour is "<<studyHours;

return 0;

}

You might be interested in
To help determine which technology to use, Raul creates a table to help him compare the pros and cons of his choices. What part
love history [14]

The answer is analyzing choices/options

Analyzing choices/options is one of the several steps of the decision making processes. Analyzing your choices will help you determine how your final decisions will impact yourself and everyone else around you. It is in this step that you will be asking yourself the likelihood of the results of your decisions now and in the future. In addition, this step will help you review the pros and cons of your choices listed in the previous steps.

5 0
3 years ago
# q7 - create function readFileFirstLast() to meet the conditions below
MAVERICK [17]

Answer:

See explaination

Explanation:

def readFileFirstLast(filename):

# doc string

''' Function accept the filename and opens the fle

and reads all lines and strips new line character and

stores first and last in a string and return that string'''

#eception handle if file not found

try:

#opening the file

f = open(filename)

#reading the first line and striping the ne line

string = f.readline().strip()

#iterating until last line

for line in f:

pass

#concate the last line after strip the new line character to the string

string = string + " " + line.strip()

#return the string

return string

except:

#if file not found

return "File not found"

#taking the file name from user

filename = input("Enter a file name: ")

#printing the doc string in function

print("\ndoc_sting: \n"+ readFileFirstLast.__doc__+"\n")

#printing the returned string by calling the readFileFirstLast()

print("output string :")

print(readFileFirstLast(filename))

3 0
3 years ago
ShellShock had the potential for an unauthorized user to gain access to a server. It affected many internet-facing services, whi
mina [271]

Answer: Windows

Explanation:

ShellShock: Also called Bashdoor, it is a security bug which is found in the Bash shell of operating system e.g. Unix. It allows the hacker to execute scripts and commands by gaining unauthorized access. This affects many machines, devices that use Bash. Servers like web servers are most affected as most of them run Unix based OS like OS X. Most vulnerable are those who use Unix or Linux operating systems.  

Microsoft Windows does not use Bash so it does not directly affect Windows os. For those who are using Windows PC, Windows phones and websites that are developed by MS software are non-vulnerable to ShellShock.

4 0
3 years ago
Create a Trip class. Include as data members destination, distance traveled, total cost of gasoline, and number of gallons consu
Luba_88 [7]

The answer & explanation for this question is given in the attachment below.

Download docx
4 0
3 years ago
In which way is a worm different from a virius
dangina [55]
A worm as a multicell organism, but a virus is a single cell.
3 0
3 years ago
Other questions:
  • Wich of these is an example of magnetic storage
    11·1 answer
  • What is a strictly layered pattern, provide an example of its usage.
    13·1 answer
  • A lack of financial literacy can cause you to lose your
    10·1 answer
  • A powerboat is about to cross paths with a sailboat under sail. What should the powerboat do
    5·1 answer
  • In paragraph form, explain and describe at least three common situations in which you would yield the right-of-way.
    5·1 answer
  • Lab 6B: printing a binary number
    13·1 answer
  • How is internet connection made possible.​
    7·1 answer
  • What is the purpose of a report?
    12·2 answers
  • HELP!!!
    15·2 answers
  • Product of -6/13 and reciprocal of -7/16 is ____________​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!