Home > Back-end >  Bosses, help!!
Bosses, help!!

Time:09-21

# include
using namespace std;

Struct box
{
Char maker [40].
Float height;
Float width;
The float length;
Float volume;
Box * next;
};

Box * head;

Box * the create ()
{
Float heights;
Box * p=NULL;
Box * q=NULL;
The head=NULL;
cout <"Both please enter box height" & lt; Cin & gt;> Heights;
While (heights!=0)
{
P=new box;
P - & gt; Height=heights;
cout <"Both please enter box width & lt;" Cin & gt;> P - & gt; Width;
cout <"Both please enter box length" & lt; Cin & gt;> P - & gt; length;
cout <"Both please enter box maker" & lt; Cin. Getline (p - & gt; Maker, 40);
If (head==NULL)
{
The head=p;
}
The else
{
Q - & gt; Next=p;
}
Q=p;
cout cout <"Both please enter box height" & lt; Cin & gt;> Heights;
}
cout If (a head!=NULL)
{
Q - & gt; Next=NULL;
}
Return the head;
}

Void the display (box * head)
{
cout <"Box height, width, length, volume and maker." & lt; While (the head!=NULL)
{
cout <"Height=" & lt; <"Width=" & lt; <"Length=" & lt; <"Volume=" & lt; <(the head - & gt; Height) * (head - & gt; Width) * (head - & gt; Length) & lt; <"Maker is" & lt; The head=head - & gt; next;
}
}

Int main ()
{
The display (the create ());
system("pause");
return 0;
}


My zha don't let me enter this step jump over

CodePudding user response:

Because the above input have enter, so will be over

CodePudding user response:

fflush(stdin);
Cin. Getline (p - & gt; Maker, 40);
So it is good

CodePudding user response:

reference 1/f, Simple, Soft reply:
because the above input have enter, so will be over

# include
using namespace std;

Struct box
{
Char maker [40].
Float height;
Float width;
The float length;
Float volume;
Box * next;
};

Box * head;

Box * the create ()
{
Float heights;
Box * p=NULL;
Box * q=NULL;
The head=NULL;
cout <"Both please enter box height" & lt; Cin & gt;> Heights;
While (heights!=0)
{
P=new box;
P - & gt; Height=heights;
cout <"Both please enter box width & lt;" Cin & gt;> P - & gt; Width;
cout <"Both please enter box length" & lt; Cin & gt;> P - & gt; length;
cout <"Both please enter box maker" & lt; fflush(stdin);
Cin. Getline (p - & gt; Maker, 40);
If (head==NULL)
{
The head=p;
}
The else
{
Q - & gt; Next=p;
}
Q=p;
cout cout <"Both please enter box height" & lt; Cin & gt;> Heights;
}
cout If (a head!=NULL)
{
Q - & gt; Next=NULL;
}
Return the head;
}

Void the display (box * head)
{
cout <"Box height, width, length, volume and maker." & lt; While (the head!=NULL)
{
cout <"Height=" & lt; <"Width=" & lt; <"Length=" & lt; <"Volume=" & lt; <(the head - & gt; Height) * (head - & gt; Width) * (head - & gt; Length) & lt; <"Maker is" & lt; The head=head - & gt; next;
}
}

Int main ()
{
The display (the create ());
system("pause");
return 0;
}
Still a problem

CodePudding user response:

Still the same problem?

CodePudding user response:

refer to 4th floor, Simple, Soft reply:
is still the same problem?

Thank you, I understand, and cin. First the get ()