A small problem with C ++ (话外: publishing an article is really inconvenient)

zhaozj2021-02-16  91

Establishing a class Box, the constructor of the Box is transmitted three Double values, each Double value represents a border of the box. Calculate the volume of the cube with the Box class and store it in a Double variable. A member function Vol () is included in the Box class to display the volume of each Box object.

#include

Class Box {

Double Chang, Kuan, GAO

PUBLIC:

Box A (Double C, Double K, Double G)

{chang = C; kuan = k; gau = g;}

Double Vol ()

{DOUBLE V;

v = chang * kuan * GAO;

Return v;}

}

void main ()

{

Double C, K, G;

Box a (Double C, Double K, Double G);

CIN >> C >> K >> G;

COUT << "v =" <

<

Error message: 3.10.cpp (17): Error C2228: Left of '.vol' Must Have Class / Struct / Union TypeError Executing Cl.exe.

3.10.obj - 1 Error (s), 0 Warning (s)

Why do you say that it is not a Class type, how can I pass,

转载请注明原文地址:https://www.9cbs.com/read-15727.html

New Post(0)