Computer Science: A Structured Programming Approach Using C, Third Edition
3rd Edition
ISBN: 9780534491321
Author: Behrouz A. Forouzan, Richard F. Gilberg
Publisher: Course Technology, Inc.
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 2, Problem 11PS
To print data left justified, you would use a
a. flag
b. precision
c. size
d. width
e. width and precision
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
_____ is a value that exceeds the format 's numeric range and is treated as an error by the cpu?
Which of the following is the data type used to hold decimal numbers?a. double b. int c. byte D. single to. short
Refer to the following code. Which line may be used to complete the code so it would not result to an error?
count = 15
while count > 5:
print(count)
_________
count = count - 4
count += 1
count == count
none of these; the code is complete by itself
Chapter 2 Solutions
Computer Science: A Structured Programming Approach Using C, Third Edition
Ch. 2 - The purpose of a header file, such as stdio.h, is...Ch. 2 - Prob. 2PSCh. 2 - The C standard function that receives data from...Ch. 2 - Which of the following statements about the...Ch. 2 - Which of the following statements about block...Ch. 2 - Prob. 6PSCh. 2 - Which of the following is not a data type?...Ch. 2 - The code that establishes the original value for a...Ch. 2 - Prob. 9PSCh. 2 - Prob. 10PS
Ch. 2 - To print data left justified, you would use a in...Ch. 2 - Prob. 12PSCh. 2 - One of the most common errors for new programmers...Ch. 2 - Which of the following is not a character constant...Ch. 2 - Which of the following is not an integer constant...Ch. 2 - Which of the following is not a floating-point...Ch. 2 - Prob. 17PSCh. 2 - Which of the following is not a valid identifier...Ch. 2 - What is the type of each of the following...Ch. 2 - What is the type of each of the following...Ch. 2 - Which of the following identifiers are valid and...Ch. 2 - Which of the following identifiers are valid and...Ch. 2 - What is output from the following program...Ch. 2 - Prob. 24PSCh. 2 - Find any errors in the following program....Ch. 2 - Find any errors in the following program....Ch. 2 - Prob. 27PSCh. 2 - Prob. 28PSCh. 2 - Prob. 29PSCh. 2 - Code the variable declarations for each of the...Ch. 2 - Code the variable declarations for each of the...Ch. 2 - Write a statement to print the following line....Ch. 2 - Write a program that uses four print statements to...Ch. 2 - Write a program that uses four print statements to...Ch. 2 - Write a program that uses defined constants for...Ch. 2 - Prob. 36PSCh. 2 - Prob. 37PSCh. 2 - Write a program that prompts the user to enter an...Ch. 2 - Write a C program using printf statements to print...Ch. 2 - Write a program that reads a character, an...Ch. 2 - Write a program that prompts the user to enter...Ch. 2 - Write a program that reads 10 integers and prints...Ch. 2 - Write a program that reads nine integers and...
Knowledge Booster
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
- Which of the following C# types cannot contain floating-point numbers? a. float b. double c. decimal d. intarrow_forward(Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point numbers with random numbers that have been scaled to the range 1 to 100. Then determine and display the number of random numbers having values between 1 and 50 and the number having values greater than 50. What do you expect the output counts to be?arrow_forwardI have this code but it needs to work in lc3 stimulate by, it only allows user to type characters and does not prompt user with instructions etc. Prompt the user with instructions Allow user to type characters They will be uppercase, lowercase, numbers, spaces, and punctuation Show the user each character they typed as they type them When the user types numeric zero (0), stop accepting character Report to user how many lowercase 'a's were entered to the user Automatically start over .ORIG x3000 AND R1,R1,#0 ; R1=0 (counter) LD R3, ASCIIA ; R3=#97 NOT R3,R3 ADD R3,R3,#1 ; R3=#-97 LD R4, ASCII0 ; R4=#48 NOT R4,R4 ADD R4,R4,#1 ; R4=#-48 loop GETC ; Read a characters from keyboard. OUT ; print the character entered ADD R2,R0,R4 ; check whether character is 0 BRZ done ; if character is 0, exit the loop ADD R2,R0,R3 ; otherwise, check whether the character is 'a' BRZ count ; if character is 'a', go to label Count BR loop ; otherwise, repeat the loop count ADD R1,R1,#1 ; increment the…arrow_forward
- 1. Generate a number of random integer values within a given rangeRequirements: - Ask the user the following info: a. How many random numbers they would like to have b. What is the upper and lower limit (e.g. range)? - Generate that many random numbers within that given range - Do not accept negative values for the count, lower or upper limit Help: Here is a simple example on how to generate one random number #include <iostream>#include <ctime>using namespace std; int main(){ /* get the current system time and use it as the seed to generate*/ srand( time(0) ) ; /* retrieve the next random number */ int num = rand() ; /* print it out */ cout << "Random number: " << num << endl; return 0 ;}Note: you need to call "srand" only once (e.g. not inside a loop). Extend your random generating program to make sure that the numbers are unique. In another words, if the number has been generated and appear…arrow_forwardWhich data type would be used to store a whole number that you plan to add to another number? A String B float C int D decarrow_forwardQ1 Which of the following statements is true if x (a character array) is added (+) to a y (2 x 2 double)? Select one: a. Variable x will be converted into a double and then concatenated with y to create new ASCII-type variable b. The addition operation (+) cannot be performed c. Variable y will be converted into a string and then concatenated with x to create a new string-type variable d. ASCII values of x are added to y to create a new double-type variable e. It is equivalent to the statement x == y and creates a logical-type variable Q2 Consider the following non-linear equation where x is the independent variable, y is the dependent variable, and A and B are constants. Which of the following is the resulting gradient variable in linearised form? Select one: a. B b. log10(B) c. log(-A) d. A e. exp(B) Q3 Which of the following statements is false for the function header below? function [cat, ox, dragon] = rat(pig, snake) Select one:…arrow_forward
- Explain the code and how it works: #include <iostream>#include <cmath> using namespace std;double to_kilograms(double n){ return n * 0.453592;}double to_pounds(double n){ return n * 2.20462;}double to_kilograms_ref(double& n){ return n * 0.453592;}double to_pounds_ref(double& n){ return n * 2.20462;}double to_kilograms_ptr(double* n){ return *n * 0.453592;}double to_pounds_ptr(double* n){ return *n * 2.20462;} void display_menu(){ cout << "1.Kilograms to Pounds (pass by value)\n2. Pounds to Kilograms (pass by value)\n3. Kilograms to Pounds (pass by reference)\n4. Pounds to Kilograms (pass by reference)\n5. Kilograms to Pounds (using pointers)\n6. Pounds to Kilograms (using pointers)\nEnter choice\n\n";} void convert(){ int ch; double w; cout << "Enter a menu option: "; cin >> ch; cout << "Enter weight: "; cin >> w; if (ch == 1) cout << "weight in kg is " << to_kilograms(w);…arrow_forward# ASCII Table Project * output all bytes from 0 to 255 * if it represents a printable character, print the actual character * if it is not a printable character, print a dash ("-") instead * print out the hexadecimal value of the byte* format the output into 8 columns (one column per byte) * line up all the columns ## TestsWrite at least one unit test. _This implies that you have at least one function you call._ There are at least two functions you could write (based on the product definition)arrow_forwardHi, the follwing code is return by value but I want to make it return by reference ... please help #include<iostream> using namespace std; double cubeValue (double n) {//function which takes parameter and cubes it double c = n * n * n; return c;//return by value } int main () {//main function double number; cout << "Enter the number you wish to cube: "; cin >> number; double n = cubeValue (number);//calling function and storing return by value in n cout << "The number after cubing is: " << n << endl; }arrow_forward
- Your friend asked you to check if his code is correct for creating data fields for users to select a food type using radio buttons: <input type="radio" name="french" value="Fr" /> <input type="radio" name="italian" value="It" /> <input type="radio" name="chinese" value="Ch” checked /> <input type="radio" name="indian" value="In” checked /> What your suggestions are going to be? Do you see problems in that code? Include the correct code in the answer, maybe even with additional improvement.arrow_forwardAssuming the following code is legal, what is the output after running it? DecimalFormat tForm = newDecimalFormat("\#\#.00"); System.out.println(tForm.format(12682.1));arrow_forwardThe code that I have written is provided down below i just need help revising it when i run it i only get 20/100. The instructions are down below and what it is supposed to look like. The code has different functions which is provided down below can you help please fix it and show the output. Main.cpp #include "Triangle.h"#include "Square.h"#include <iostream> using namespace std; int main() { //Do not modify Triangle t; Square s; cin >> t; t.calculateArea(); cout << t; cin >> s; s.calculateArea(); cout << s; return 0;} ---- Sqaure.cpp #include "Square.h"#include <iostream>using namespace std; Square::Square(){ base = 0; height = 0;} Square::Square(int b, int h) : base(b), height(h) { } void Square::setBase(int b){ base = b;} void Square::setHeight(int h){ height = h;} void Square::calculateArea(){ // calculate Area correctly depending on shape type area = base * height;} int Square::getBase() const{ return…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License