Q8) Write the output for each of the following statements? Each group is independent of the others 1) string str; cin. ignore(3,'n'); getline(cin, str); // At this point, the users enters Android cout « str; int x = 0; 2) if (x = 1) cout « "Pass"; else cout « Fail; enum Measures {CM, MM = 9, KM, IN, FT}; 3) сout « СM « еndl; сout « КМ « еndl; for (int i = 0; 4) cout « i « endl; ;++i) 5) int x = 0; do { сout < x; } while (x > 5); + + x;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I need those 3 answers

Write the output for each of the following statements? Each group is independent of the others
Q8)
string str;
1)
cin. ignore(3,'n');
getline(cin, str); // At this point, the users enters Android
cout « str;
int x =
0;
1) соut < "Pass";
сout < Fail;B
2)
if (x
else
%|
епит Меasures {CM, MM — 9, КМ, IN, FT};
3)
сout « СМ « еndl;
%3D
сout « КM « еndl;
4) for(int i = 0;
cout « i « endl;
;++i)
5) int x =
: 0;
do {
сout < x;
} while (x > 5);
+ + x;
Q9)
Write a C++ program which performs the following steps. Assume that all includes are present.
1) Prompt the user to enter a value and store it in a variable called upper
2) Generate and print 10 random numbers between 1 and upper (inclusive).
Q10) implement the following C++ program which includes the following members:
1) Implement the function readFile as follows:
The function accepts one parameter of type vector. The vector will store double data types.
b. The function reads the content of the file InputData.txt and add them to the vector parameter.
The function returns true if all values were successfully added to the vector. Otherwise, return false.
а.
с.
2) Implement the function position0f as follows:
a. The function accepts two parameters, a constant vector parameter and a parameter of type double (called
searchFor).
b. The function returns the position of searchFor in the vector. If the value is not found, return -1. For
example, if the value of searchFor is at the beginning of the vector, the function returns 0. If it is in the
second position, the functions returns 1 ...
3) Write a main function as follows
Invoke the function readFile. If the function returns true, continue to the next step, otherwise print an error
message and terminate the program.
b. Invoke the function position0f. Use the vector from the previous step and search for the value 37.89. Print
the retuned result. Hint: this function call should returns 16.
Invoke the function position0f once more and search for the value 10.01. Print the retuned result. Hint: this
function call should returns -1.
d. Copy the data from the vector into an array of size 30. If the value in the vector is negative, change it
positive then add it to the array. The final version of the array should only contain positive numbers.
а.
с.
Transcribed Image Text:Write the output for each of the following statements? Each group is independent of the others Q8) string str; 1) cin. ignore(3,'n'); getline(cin, str); // At this point, the users enters Android cout « str; int x = 0; 1) соut < "Pass"; сout < Fail;B 2) if (x else %| епит Меasures {CM, MM — 9, КМ, IN, FT}; 3) сout « СМ « еndl; %3D сout « КM « еndl; 4) for(int i = 0; cout « i « endl; ;++i) 5) int x = : 0; do { сout < x; } while (x > 5); + + x; Q9) Write a C++ program which performs the following steps. Assume that all includes are present. 1) Prompt the user to enter a value and store it in a variable called upper 2) Generate and print 10 random numbers between 1 and upper (inclusive). Q10) implement the following C++ program which includes the following members: 1) Implement the function readFile as follows: The function accepts one parameter of type vector. The vector will store double data types. b. The function reads the content of the file InputData.txt and add them to the vector parameter. The function returns true if all values were successfully added to the vector. Otherwise, return false. а. с. 2) Implement the function position0f as follows: a. The function accepts two parameters, a constant vector parameter and a parameter of type double (called searchFor). b. The function returns the position of searchFor in the vector. If the value is not found, return -1. For example, if the value of searchFor is at the beginning of the vector, the function returns 0. If it is in the second position, the functions returns 1 ... 3) Write a main function as follows Invoke the function readFile. If the function returns true, continue to the next step, otherwise print an error message and terminate the program. b. Invoke the function position0f. Use the vector from the previous step and search for the value 37.89. Print the retuned result. Hint: this function call should returns 16. Invoke the function position0f once more and search for the value 10.01. Print the retuned result. Hint: this function call should returns -1. d. Copy the data from the vector into an array of size 30. If the value in the vector is negative, change it positive then add it to the array. The final version of the array should only contain positive numbers. а. с.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Public key encryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education