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
Problem 6. (Fibonacci Number) Write a program fibonacci.py that accepts n (int) as command-line argument, and writes to standard
77julia77 [94]

Answer:

  1. import sys
  2. def fibonacci(n):
  3.    if(n == 0 or n == 1):
  4.        return n  
  5.    else:
  6.        return fibonacci(n - 2) + fibonacci(n-1)
  7. num = int(sys.argv)  
  8. output = ""
  9. for i in range(1, num+1):
  10.    output += str(fibonacci(i)) + " "  
  11. print(output)

Explanation:

Firstly, we import sys module as we need to accepts n as command line argument (Line 1).

Next, create a function fibonacci takes take one input n (Line 3). If the n is zero or one, return the n itself (Line 4-5). Otherwise, the program shall run the recursive call to the fibonacci function itself by putting n-2 and n-1 as function argument, respectively (Line 6-7).

After that, use the sys.argv to get the command line argument and assign the value to num (Line 9).

Use a for loop to generate the output string by progressively calling the fibonacci function and join the return result to the output string (Line 12-13).

At last print the output string (Line 15).

7 0
3 years ago
The values of the member variables of objectOne are being copied into the corresponding member variables of objectThree. This in
djyliett [7]

Answer:

member wise Initialization.

Explanation:

Member wise initialization is used for the following cases:-

  1. When you have constant member in your class.
  2. When you have Reference member in your class.
  3. When you have a very large member in your class.
  4. When you have a member with no default constructor.

Member wise initialization is uses initialization and the direct initialization uses assignment.

8 0
4 years ago
The browser on which you are viewing web pages is called the
iren2701 [21]

Answer:

client

server

Explanation:

The browser is the client, and the system that sends you the web page is known as the server. And these together form the client-server architecture. A perfect example of a client-server model is, however, a video game that has an app for the client, and a server. And as an example, such set up is established using the socket programming or the SignalR in dot net. Various other technology does support socket programming. And you can find it in fact on all the platforms.

5 0
3 years ago
With _______, applications are owned, delivered and managed remotely by one or more providers over the Internet or an intranet,
vfiekz [6]

Answer:

EMAIL

Explanation:

3 0
3 years ago
380<br> 787<br> What is380+787=
nignag [31]
The awnser is 1167 ..
7 0
3 years ago
Read 2 more answers
Other questions:
  • a problem exists when the current condition differs from a desired condition. This idea defines which step in problem-solving?
    13·2 answers
  • Why does people that gets abused not report?
    5·1 answer
  • With a two-dimensional array, the ____ field holds the number of rows in the array.
    6·1 answer
  • A computer’s BIOS is defined as the
    12·2 answers
  • Write a program that uses an "if" statement to determine if the number is greater than one. If the number is greater than 1, the
    9·1 answer
  • Discuss the infrastructure necessary for the Internet of Things and Cloud computing to exist. What unique services does this ena
    7·1 answer
  • 1i) Standardize 'weight' column Write a function named standardize_weight that takes in as input a string and returns an integer
    14·1 answer
  • What happens if none of the selector values match selector in a simple case expression in pl/sql
    6·1 answer
  • During the first six months of his job, Enrique's boss gave him weekly feedback about his performance. What component of effecti
    9·1 answer
  • 1. Write a statement that opens the file Customers.dat as a random access file for both reading and writing.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!