Identify and fix the errors in the following code:
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
Introduction to Programming with C++
- Deal or No Deal? Code in C languagearrow_forwardAssignment: Class, Constructors, Destructors 1. Write a c++ program that uses <iostream> that has a class staff having fields: Staff_id , name, salary. Writea menu driven program for: 1) To accept the data2) To display the data3) To sort the data by namearrow_forwardAssume the Product structure is declared in c++ as follows:struct Product{string description; // Product descriptionint partNum; // Part numberdouble cost; // Product cost}; Now write a loop that will step through the entire array array of 100 Product structures (do not initialize the array), setting all the product descriptions to an empty string, all part numbers to zero, and all costs to zero. ( Drop the screenshot of output as well )arrow_forward
- Please help me in c++ languagearrow_forwardAnswer complete 6th question pleasearrow_forwardLAB: Expression for calories burned during workout Instructor note: Important Coding Guidelines: Please do in C++ Use comments, and whitespaces around operators and assignments. Use line breaks and indent your code. Use naming conventions for variables, functions, methods, and more. This makes it easier to understand the code. Write simple code and do not over complicate the logic. Code exhibits simplicity when it’s well organized, logically minimal, and easily readable. The following equations estimate the calories burned when exercising (source): Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Men: Calories = ( (Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Write a program with inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men. Output each floating-point value with two digits…arrow_forward
- #include using namespace std3; int main() { int s-4; int d-s++; cout<arrow_forwardPlease use C++ for answerarrow_forwardVoid Do1 (int: &, a. int &b) { a = 5; a = a + b; b = a + 2; } Int main() { Int x = 10; Do1 (x,x); Cout << x << endl; } The output of this program isarrow_forwardLab 27 Introduction to Functions Learning Objectives: Create functions in C++ Apply engineering problems to programming. Lab Materials: Computer with C++ and Visual Studio installed. Procedure: Create a new C++ file with the proper lab name. Wood moves (expands and contracts) with changes in humidity. Different species of wood react differently. Most wood movement is across the grain, not with the grain. As humidity increases, the wood absorbs moisture and expands. To calculate the wood movement: Delta-Width = width * change in moisture content * moisture co- efficient. Quartersawa Flatsawn Species Alder 0.0015 0.0026 Cherry 0.0013 0.0025 Red Oak 0.0016 0.0037 Black Walnut 0.0019 0.0027 Measurement is in inches. Write a that will ask the user for the change in moisture program content (expressed as a percent) and the width of the board. Display a menu that asks the user to choose a species and if it is flat or quartersawn Calculate and display the amount of wood movement as well as the…arrow_forwardC++ and Python are required to achive the goal C++ source #include <Python.h> #include <iostream> #include <Windows.h> #include <cmath> #include <string> using namespace std; /* Description: To call this function, simply pass the function name in Python that you wish to call. Example: callProcedure("printsomething"); Output: Python will print on the screen: Hello from python! Return: None */ void CallProcedure(string pName) { char *procname = new char[pName.length() + 1]; std::strcpy(procname, pName.c_str()); Py_Initialize(); PyObject* my_module = PyImport_ImportModule("PythonCode"); PyErr_Print(); PyObject* my_function = PyObject_GetAttrString(my_module, procname); PyObject* my_result = PyObject_CallObject(my_function, NULL); Py_Finalize(); delete[] procname; } /* Description: To call this function, pass the name of the Python functino you wish to call and the string parameter you want to send Example: int x = callIntFunc("PrintMe","Test"); Output:…arrow_forward#include #include using namespace std; void func(); int main(); { func (); func(); system("PAUSE"); return 0; } void func() { int x = 0; static int y = 0; x++; y++; cout << x << "__" << y << endl; } What will the code above print when it is executed?arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education