What is errors in this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is errors in this code

public: double length; // Length of a box double breadth; // Breadth of a box double height; // Height of a box }; int main( ) { Box Box1; // Declare Box1 of type Box Box Box2; // Declare Box2 of type Box double volume = 0.0; // Store the volume of a box here // box 1 specification Box1.height = 5.0; Box1.length = 6.0; Box1.breadth = 7.0; // box 2 specification Box2.height = 10.0; Box2.length = 12.0; Box2.breadth = 13.0; // volume of box 1 volume = Box1.height * Box1.leng

26th Oct 2017, 5:09 PM
Semo Ahmed
Semo Ahmed - avatar
3 Answers
+ 6
You're missing the 'class' line that declares a Box Your code is truncated: "Box1.leng" It produces no output so I assume the next line (missing) outputs "volume". If you want to help people test / fix (I'm only hinting) a CodePlayground link would help people answer.
26th Oct 2017, 5:29 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Getting code into CodePlayground: Tap on your profile picture. Tap "0 CODES" on the left. Tap the green (+) in the lower right-hand corner. Choose C++ Paste your code into the editor. [RUN] it if you wish. Save the code (three dots = menu) To share the link, either do this: 1. Save your file, then choose the < symbol with three dots on it. 2. Choose "Copy to Clipboard" 3. Paste the link into any post. Or when posting a new answer in Q&A: Tap "+ Insert..." at the bottom left Tap "Insert Code" in the menu that appears Change "Trending..." to "My Codes" on the right Select the code you just saved.
26th Oct 2017, 10:33 PM
Kirk Schafer
Kirk Schafer - avatar
0
can you help me
26th Oct 2017, 10:01 PM
Semo Ahmed
Semo Ahmed - avatar