What is the output of the following code: #include #include using namespace std; int main(){ double x = 142.366; cout <« setw( 5) << setiosflags(ios::fixed) << setprecision(2) << x « endl; cin.ignore(); return 0; }
Q: Predict the Output #include <iostream> #include <cstring> using namespace std; int…
A: Given: Predicting Output.
Q: #include using namespace std; int Fibonacci(int n) { /* Type your code here. */ } int main() {…
A: Required c++ code according to template provided is given below:
Q: #include using namespace std; #define numVl 3 struct thNde { thNde* parent; int…
A: The code is written in C++ but instead of cout used printf for printing the outputs in code. Some…
Q: #include #include using namespace std; int main() { double weight, distance; double…
A: Hello student Greetings Hope you are doing great Thank You!!!
Q: can you fix my code in c++? #include #include #define SIZE 3 using namespace std;…
A: #include <iostream> #include <string> #define SIZE 3 using namespace std; string…
Q: This is the code so far #include // for cin and cout #include // for setw() and setfill() using…
A: Output :-
Q: #include #include struct employees { char name[20]; int ssn[9]; int yearBorn, salary;…
A: Code is implemented in dev C++ :- There are 2 errors:- 1) To run this line struct employees *emp =…
Q: 1. execute the program in the background 2. obtain process status 3. show to the zombie child…
A: The Program referenced in the question Lab7.c ,creates a Zombie process. The program creates a…
Q: // Add to this partially built code. // fill in code where there is a TODO…
A: Add data type char for variables destination and typeOfDay. Define bool variable isDayTime and…
Q: 1 #includeciostream> 3 using namespace std; 4 5 typedef char box[9]]); 7 int main() 8e ( 9 box…
A: Based on c++
Q: Write a negation for the following statements; What is the difference between canonical form and…
A: Answer: 1. Normalized form: It represented some variables without minimization. Ex :- F = AB' + AB +…
Q: include #include using namespace std; int main() { double weight, distance; double…
A: According to the Question below the solution: Output:
Q: #include using namespace std; bool isThere(string s, char c, int si, int ei){ //return true if…
A: Input : string s char c int si int ei Output : Write the code to check if the character c is…
Q: C++ It keeps telling me build fail when i run it. Please help me find the mistakes. .....…
A: Explanation: You’re using the “foundwordPos” without any purpose while generating "wordStr" .…
Q: What is wrong in the following code? #include <iostream>#include <string> using…
A: Program: Programs are the set of instructions that are used to perform certain tasks according to…
Q: C++ Program: Improve my code #include #include using namespace std; #include struct…
A: struct node * is a pointer to an element of a structure node
Q: Please explain this code: #include #include using namespace std; int main() { char…
A: This is C++ code. In this question, we have to explain the code. In the end we will also attach the…
Q: How to fix the infinite loop in this source code: #include #include using namespace std; int…
A: It is always a good idea to use infinite loop and breaking at some condition But, there was only one…
Q: HELP ME FIX MY CODE #include using namespace std; void breakapart(int n, int &a, int &b, int…
A: EXPLANATION: Following is the corrected code for representing the required result: #include…
Q: Predict the Output #include <iostream> #include <string> using namespace std; int…
A:
Q: Please help, #include // malloc/free and NULL // Include the declarations of our string…
A: Here i explain what function do: ==============================================================…
Q: #include #include using namespace std; int main() { double weight, distance; double…
A: Hello student Greetings Hope you are doing great Thank You!!!
Q: Remove error from following cpp program: CODE: #include #include using namespace std; class…
A: Step 1:- Error:-
Q: // Add to this partially built code. // fill in code where there is a TODO…
A: Add data type char for variables destination and typeOfDay. Define bool variable isDayTime and…
Q: #include #include using namespace std; int main() { double weight, distance; double…
A: This program calculates the package rates from weight of the package and distance the package will…
Q: What will be the output of the code given below. #include using namespace std; int main() {…
A: Given Code contains a loop that runs from i=0 to i=10. Inside the loop the value of variable i is…
Q: Q9:- Which data-type .maketrans() return? Table List Tuple Dictionary Q 10:- How to loop over…
A:
Q: Predict the Output #include <iostream> using namespace std; int main(){cout <<…
A: Given: Predict the Output #include <iostream> using namespace std; int main(){cout <<…
Q: what is wrong with this programming? #include #include using namespace std; int main() { string…
A: #include <iostream>#include<bits/stdc++.h>using namespace std;int main(){string…
Q: 2.20 LAB: Hypotenuse Given two numbers that represent the lengths of a right triangle's legs (sides…
A: Introduction: The name "Hypotenuse" in mathematics derives from the Greek word hypoteinousa, which…
Q: Program Specifications Write a function called rCopy that copies the entire contents of one file to…
A: I have designed and developed the program for the given question Assuming that it is to be written…
Q: draw algritm for this cod. #include #include using namespace std; int main(){ //for prointing…
A: An algorithm is a detailed description of instructions using natural language which is followed,…
Q: #include #include #include using namespace std; template class A { T a; U b; public:…
A: Given, The code is given in the C++ programming language Code: #include <iostream>…
Q: plesase provide flow chart for this code #include #include #include #include using namespace…
A: The given problem has a program in C++ and the requirement is to build a flowchart for the flow of…
Q: Need output #include #include using namespace std; int main(int argc, char const *argv[]) {…
A: Coded using C++.
Q: Complete the function using a range loop. The function should return a single string with all spaces…
A: sample output
Q: Predict the Output #include <iostream> #include <cstring> using namespace std; int…
A: Given: Predict the Output #include <iostream> #include <cstring> using namespace std;…
Q: #include #include using namespace std; int main() { int array[] = {10, 20, 30}; cout <<…
A: Required: What is the output of above C++ code?
Q: b) The following code fragment passes data by reference. Convert it to the one that passes data by…
A: #include <bits/stdc++.h> using namespace std; void exponen(double num); // Declaration the…
Q: double z; cin >> x; cin >> y; answer here
A: Given: #include <iostream>#include <cmath>#include <ios>#include…
Q: 2. Add the code to display the first two building sections below the top of the tower, all still…
A: C++ program to complete the above code and print the given output using for loop.
setprecision (2) basically round off decimal place upto 2 digit
Step by step
Solved in 3 steps with 1 images
- C++ Given code is #pragma once#include <iostream>#include "ourvector.h"using namespace std; ourvector<int> intersect(ourvector<int> &v1, ourvector<int> &v2) { // TO DO: write this function return {};}#include <iostream>#include<iomanip> using namespace std; int main(){ double weight, distance; double rate; cout<<fixed<<setprecision(2); //set precision cout<<"Enter the weight of package: "; cin>>weight; cout<<"Enter the distance to travelled: "; cin>>distance; if((weight > 0 && weight < 21) && (distance > 9 && distance < 2001)){ if(weight <= 2){ rate = (14.85 / 500) * distance; }else if(weight > 2 && weight <= 6){ rate = (20.30 / 500 ) * distance; }else if(weight > 6 && weight <= 10){ rate = (31.80 / 500 ) * distance; }else if(weight > 10 && weight <= 21){ rate = (53.00 / 500 ) * distance; } cout<<"\nCharges for "<< weight <<" kg to travelled…>> IN C PROGRAMMING LANGUAGE ONLY << COPY OF DEFAULT CODE, ADD SOLUTION INTO CODE IN C #include <stdio.h>#include <stdlib.h>#include <string.h> #include "GVDie.h" int RollSpecificNumber(GVDie die, int num, int goal) {/* Type your code here. */} int main() {GVDie die = InitGVDie(); // Create a GVDie variabledie = SetSeed(15, die); // Set the GVDie variable with seed value 15int num;int goal;int rolls; scanf("%d", &num);scanf("%d", &goal);rolls = RollSpecificNumber(die, num, goal); // Should return the number of rolls to reach total.printf("It took %d rolls to get a \"%d\" %d times.\n", rolls, num, goal); return 0;}
- // Add to this partially built code. // fill in code where there is a TODO #include<iostream> using namespace std; int main() { cout.setf(ios::fixed); cout.setf(ios::showpoint); // show decimals even if not needed cout.precision(2); // two places to the right of the decimal // TODO: enter the missing types below int time; float ticketPrice; destination; //'C'=Chicago, 'P'=Portland, 'M'=Miami typeOfDay; //'D'=weekDay 'E'=weekEnd cout << "Welcome to Airlines!" << endl; cout << "What is your destination? ([C]hicago, [M]iami, [P]ortland) "; cin >> destination; cout << "What time will you travel? (Enter time between 0-2359) "; cin >> time; // TODO: set isDayTime to true if time 5AM or later, but before 7PM cout << "What type of day are you traveling? (week[E]nd or week[D]ay) "; cin >> typeOfDay; // TODO: set isWeekend to true if typeOfDay is 'E', otherwise false // Depending upon the destination, and whether…Read the following program. int _tmain(int argc, _TCHAR* argv[]) { int a=6,b=3; cout<<--a; cout<<++b; cout<<(a++)/(b--); getch(); return 0; } List the total number of decrement operator used in the above program a. 3 b. 1 c. 2 d. 4#include #include using namespace std; //function prototypesint countLetters(char*); int countDigits(char*); int countWhiteSpace(char*); int main() { int numLetters, numDigits, numWhiteSpace; char inputString[51]; cout <<"Enter a string of no more than 50 characters: " << endl << endl; cin.getline(inputString,51); numLetters = countLetters(inputString); numDigits = countDigits(inputString); numWhiteSpace = countWhiteSpace(inputString); cout << "The number of letters in the entered string is " << numLetters << endl; cout << "The number of digits in the entered string is " << numDigits << endl; cout << "The number of white spaces in the entered string is " << numWhiteSpace << endl; return 0; } int countLetters(char *strPtr) { int occurs = 0; while(*strPtr != '\0') // loop is executed as long as// the pointer strPtr does not point // to the null character which// marks the end of the string // isalpha determines…
- What will be the output of given code. #include<iostream>using namespace std; int add(int a,int b){return (a+b);}int main(){int a=5,b=3;cout<<add(a,b)<<endl;}Predict the Output #include <iostream> using namespace std; int main(){cout << ("hello")[1]; return 0;}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);…
- Predict the Output #include <iostream> #include <cstring> using namespace std; int main(){cout << strcmp("a", "b"); return 0;}Please fix this code for me, I'm stuck . #include<iostream>#include <iomanip>using namespace std;// the main bodyint main(){std::string item[10],name;int n;float price[10],ST_VAT[10],tax[10],total=0.0,Net;cout<<"Enter the number of items that should be atleast 5 : ";cin>>n;cout<<"Enter the customer's name ";cin>>name;for(int i=1;i<=n;i++){ std::cout<<"\nEnter the item "<<i<<" name , cost, sales tax and VAT :";cin>>name>>price[i]>>ST_VAT[i];tax[i]=price[i]+ST_VAT[i];total=total+tax[i];}Net=total-0.05*total;cout<<swet(5)<<"Food Stuff Grocery Shop"<<endl;cout<<"Customer Name"<<name<<endl;cout<<"ITEM"swet(8)<<"PRICE"<<swet(15)"Sales Tax+ VAT"<<swet(10)<<Sub-Total endl;cout<<SWET(8)<<"------------"<<swet(15)<<"--------------"<<swet(10)<<"----------"endl;for(int…My C program admin option is not working. Please help me fix it and explain what's wrong. ----------- #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> void admin() { char pass[21]; int loop = 1; int in = 1; int pass1; system("cls"); for(loop = 1; loop<=in;) { printf("Enter Password: "); scanf("char",&pass [21]); pass1 = strcmp(pass, "admin"); if (pass1 == 0) { system("cls"); in = 0; printf("Password Confirm !!"); admin(); } else { system("cls"); in = 1; printf("Access Denied !!"); } } } void admin2() { int i,w; int item_code[20] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; int item_code2; printf("Welcome: Admin --"); printf("MENU");…