I am stuck with this C++ code.Please help
Q: #include using namespace std; class test{ public: test(){ cout<<"alpha\n"; } ~test(){…
A: This is about classes and the constructors.
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: This expands the previous work to enable handling multiple employees. You will do this by…
A: #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int…
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: C programming: Stacks. Help fully understand the code below by putting comments. THanks! ...…
A: This is the program to calculate infix equation using stack. Algorithm: 1. set two stack: operand…
Q: Please help me how can I write the code here #include #include // Function to repeat a string…
A: Include the necessary libraries: <iostream>, <string>.Define a function multiply that…
Q: please can you add professional c++ comments in this code using the // command after each line…
A: In simple terms, a program is a set of instructions or a sequence of commands written in a specific…
Q: Given the code: void c(int n) { if(n<2) { cout << n <<""; return; } c(n/2); cout << n << " "; } 11.…
A: C++ program given and n =12
Q: Can you tell me about the most important distinction between connectionless communication and…
A: The answer :
Q: Given the C++ code: // toh.cpp #include #include using namespace std; int main() { vector…
A: #include <iostream>#include <vector>using namespace std; int main() {…
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: please provide flow chart this code //Header Files #include using namespace std;…
A:
Q: explain the working of this code.. explain each line of this code #include using namespace std;…
A: #include <iostream> using namespace std; // main function int main(){ // a string "An…
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: 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: plz correct this code #include using namespace std; int main() { int i,sum; sum=0; i=1; do {…
A: Program Details: The above program displays first 10 natural numbers. Later total these numbers.…
Q: The last part of this code I need the gallon round to the nearest number, but it still shows wrong…
A: You should change the round function to ceil() function. Code: #include <iostream>#include…
Q: Range based for loop is relatively new in C++. It provide a neat way to iterate a sequence. Refer…
A: Answer-1-: Initialization-: i=100 Condition-: n!=i increase-: ++n Initialization-: n=0 decrease-:…
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: Can you please correct this code #include #using namespace std; int main() { int n;…
A: #include <iostream> #using namespace std; int main() { int n; cout<<"Enter:";…
Q: paraphrase this program #include #include using namespace std; int main () { int n, i; float…
A: Program Approach: · Including necessary header files · Defining the main method ·…
Q: Show the printout of the following code: #include using namespace std, void swap(int n1, int n2) {…
A: Given; C++
Q: I write program in C# language to read three elements (X & Y & Z, R) and fi the solution of the…
A: C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft…
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: #include using namespace std; bool functionwitharray(char input1 [],char input2 []){ if ( input1<…
A: #include <iostream>using namespace std;bool functionwitharray(char input1 [],char input2 []){…
Q: Make a flowchart of this c++ program: #include using namespace std; int main () { cout…
A: A flowchart is a pictorial representation of a step-by-step process of solving a problem.
Q: Need output #include #include using namespace std; int main(int argc, char const *argv[]) {…
A: Coded using C++.
Q: Given the code: void b(int n) { if(n<2) { cout <<n<< " "; " 1. return; } b(n-2); cout <<n << " "; }…
A: Following are the complete code to the given question: #include <iostream>//header fileusing…
Q: Using C++ Built-in Functions in C++ #include #include using namespace std; int main()…
A: ANSWER: Function in C++:
Q: 2. Write a program that prompts the user for a positive integer N>1, then calls a function called…
A: Modified code: #include <iostream>using namespace std; //method definitiondouble FACT_SUM…
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: 4.) Universal Set: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 Set A: [1,2,3,5,8,13] Set B:…
A: The C++ code is given below with output screenshot
Q: Write a function to convert a decimal number to a binary number.
A: These question answer is as follows,
Q: Instructions: 1. Read and analyze the given code. 2. Print out "Same" if all of their 2nd characters…
A: Start input three string read its second character that is on 1st index check if it is same for all…
Q: Can you solve this write coding 2 you can use code 1 Solve this using c++
A: Step 1:- Given Program Approach:- 1.Remove the p[n] and make some changes that are given below…
Q: Write a program that will calculate course and overall final mark (averages). You write a universal…
A: Step 1 : Start Step 2 : Define an array to store the marks. Step 3 : Define the pointer and set the…
Q: Question 3: Write and test the following computecirclet) function that returms the area a and the…
A: Logic Explanation: Area of circle = 3.14 * r * r ( where pie is 3.14 and r is radius) Circumference…
Q: C++ Given code is #pragma once #include #include "ourvector.h" using namespace std; ourvector…
A: Answer: I have complete function as in given question.
Q: Complete function RollSpecific Number() that has three parameters: a GVDie struct object, an integer…
A: The answer is given in the below step
Q: Read the following program. int _tmain(int argc, _TCHAR* argv[]) { int a=6,b=3;…
A: The correct answer is given in step 2.
Q: return 0; } //**** *********** *** ********** // countLetters // // task: This function counts the…
A: Algorithm: Start Read string Define 3 functions countLetters,countDigits,countWhiteSpaces for…
Q: e C++ code below #include using namespace std; int main () { int first_opt, area_opt,…
A: The question is to draw the flowchart of the given program.
Q: #include using namespace std; int main() { double matrix[4][3]={{2.5,3.2,6.0},{5.5, 7.5,…
A: The problem is based on the basics of 2D arrays in c++ programming language.
Q: using c++ complete the code where it says , /* Your code goes here */ compute z= y- √2…
A: using c++ complete the code where it says , /* Your code goes here */ compute z= y- √2 #include…
I am stuck with this C++ code.Please help.
modify my code to complete it
#include <iostream>
using namespace std;
int main()
{
int n,i,prod=1 ;
cout <<"please enter a number: ";
cin >>n;
for(i=1;i<=n;i++)
{
prod = prod*i;
}
cout << "\n Product of numbers from 1 to" << n << " is:";
cout << prod;
return 0;
}
Step by step
Solved in 3 steps with 2 images
- Identify at least 7errors in the following C++ code. /* Program calculates Area of Rectangle. include iostream using std. int main() { Integer Width, Integer Height; cout >> "Enter Width"; cin << 1Num; cout<<”Enter Height”; cin<<Height; cout<<”Area is ”<<Width* Height; return nothing; {Note: It`s C++Rewrite the following code using while loop statement instead of for loop statement in C++. #include using namespace std; int main() int i, reps; double usenum, postot(0), negtot(0); cout > reps; for(i = 1; i > usenum; if (usenum > 0) postot = postot + usenum; else negtot = negtot + usenum; cout << "The negative total is " << negtot << endl; return 0;
- Question 1 is already done need help with the others though This is the C code I have so far #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int yearBorn, salary; }; struct employees **emps = new employees()[10]; //Added new statement ---- bartleby // function to read the employee data from the user void readEmployee(struct employees *emp) { printf("Enter name: "); gets(emp->name); printf("Enter ssn: "); for(int i =0; i <9; i++) scanf("%d", &emp->ssn[i]); printf("Enter birth year: "); scanf("%d", &emp->yearBorn); printf("Enter salary: "); scanf("%d", &emp->salary); } // function to create a pointer of employee type struct employees *createEmployee() { // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); // function to read the data readEmployee(emp); // returning the data return emp; } // function to…Given the C++ code: // toh.cpp#include <iostream>#include <vector>using namespace std; int main() { vector<int> t[3]; int n; cout << "Enter the number of rings: "; cin >> n; int from = 0; int candidate = 1; int to, move = 0; if ( n % 2 == 0) to = 2; // (from + to)%mod3, counter clockwise else to = 1; // (from + to)%mod3, clockwise for ( int i = n + 1 ; i >= 1; i-- ) t[0].push_back(i); t[1].push_back(n+1); t[2].push_back(n+1); if ( n % 2 == 0 ) { while ( t[1].size() < (n+1) ) { cout << "move " << ++move << ":" << " Move candidate " << candidate; cout << " from tower " << (char) (from + 'A'); cout << " to tower " << (char)(to + 'A') << endl; t[to].push_back(t[from].back()); t[from].pop_back(); if (t[(to+2)%3].back() < t[(to+1)%3].back()) from =…correct the simple C++ code: #include (iostream) using namespace std; int main [] { int n; for (a=10; a>0; a--) { cout << n << ", "; if (na==3) { cout << "countdown aborted!" break;} 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);…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");…
- Question 1 is already done need help with the others though This is the C code I have so far #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int yearBorn, salary; }; struct employees **emps = new employees()[10]; //Added new statement ---- bartleby // function to read the employee data from the user void readEmployee(struct employees *emp) { printf("Enter name: "); gets(emp->name); printf("Enter ssn: "); for(int i =0; i <9; i++) scanf("%d", &emp->ssn[i]); printf("Enter birth year: "); scanf("%d", &emp->yearBorn); printf("Enter salary: "); scanf("%d", &emp->salary); } // function to create a pointer of employee type struct employees *createEmployee() { // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); // function to read the data readEmployee(emp); // returning the data return emp; } // function to…in this C++ code program below fix all bugs or mistakes in code and explain in comments what was wrong and how you fix it (there can be problems with semi-columns, curly braces, included libraries, wrong usage of functions, inproper conversion of datatypes and etc.) #include <iostream>#include <math>use namespace std;/*print sinus of c*/int main{int c='4';cout<<"Sinus is "<<sinus(c);return ;}help me solve this in c++ please Write a program that asks the user to enter a list of numbers from 1 to 9 in random order, creates and displays the corresponding 3 by 3 square, and determines whether the resulting square is a Lo Shu Magic Square. Notes Create the square by filling the numbers entered from left to right, top to bottom. Input validation - Do not accept numbers outside the range. Do not accept repeats. Must use two-dimensional arrays in the implementation. Functional decomposition — Program should rely on functions that are consistent with the algorithm.