1-简单(宽度和高度)和最大/最小(宽度和高度)之间有什么区别?如果在内部样式中已经指定(宽度和高度)或最大/最小(宽度和高度)的元素的内容,宽度和高度增长超过指定的内容,将会发生什么?
2 - 其次,我们如何知道何时使用?(简单或最大/最小)
3 - 在以下示例中:
<html>
<head>
<style type="text/css">
p
{
max-height:50px;
background-color:yellow;
}
</style>
</head>
<body>
<p>The maximum height of this paragraph is set to 50px.
The maximum height of this paragraph is set to 50px.
The maximum height of this paragraph is set to 50px.
The maximum height of this paragraph is set to 50px.
The maximum height of this paragraph is set to 50px.
The maximum height of this paragraph is set to 50px.
The …Run Code Online (Sandbox Code Playgroud) 我已经使用循环在BST中插入了一个函数,它工作得很好.现在,当我写使用递归来做它时,我不知道它为什么不能正常工作,但是根据我的说法逻辑是正确的.似乎没有新的节点被添加到BST树中,并且在从插入函数出来之后树的头部再次变为NULL.
#include <iostream>
using namespace std;
class node{
public:
int data;
node *right;
node *left;
node(){
data=0;
right=NULL;
left=NULL;
}
};
class tree{
node *head;
int maxheight;
void delete_tree(node *root);
public:
tree(){head=0;maxheight=-1;}
void pre_display(node* root);
node* get_head(){return head;}
void insert(int key,node* current);
};
void tree::insert(int key,node *current){
if(current==NULL)
{
node *newnode=new node;
newnode->data=key;
current=newnode;
}
else{
if(key<current->data)
insert(key,current->left);
else
insert(key,current->right);
}
return;
}
void tree::pre_display(node *root){
if(root!=NULL)
{
cout<<root->data<<" ";
pre_display(root->left);
pre_display(root->right);
}
}
int main(){
tree BST;
int arr[9]={17,9,23,5,11,21,27,20,22},i=0; …Run Code Online (Sandbox Code Playgroud) 我正在制作一个程序,我Set从一个内置的STL容器类公开继承我的类set.我必须使用迭代器类型,同时为我自己的Set类创建一些其他专用函数,如stlset类中所定义.
现在我的问题是:在我的成员函数中声明迭代器类型变量的语法是什么?我已经试了:
template<typename T>
class Set : public set<T> {
public:
bool func()
{
iterator it,it2;
}
};
Run Code Online (Sandbox Code Playgroud)
但编译器无法识别迭代器类型.请告诉我使用stl set类中的迭代器类型的语法.
我一直在尝试实现delete BST功能,但不知道为什么它不起作用,我认为它在逻辑上是正确的。任何机构都可以告诉我,为什么我会收到运行时错误以及我应该如何纠正它。
#include <iostream>
using namespace std;
class node{
public:
int data;
node *right;
node *left;
node(){
data=0;
right=NULL;
left=NULL;
}
};
class tree{
node *head;
int maxheight;
public:
tree(){head=0;maxheight=-1;}
bool deletenode(int key,node* root);
int get_height(){return maxheight;}
void insert(int key);
void pre_display(node* root);
void delete_tree(node *root);
node* get_head(){return head;}
};
void tree::insert(int key){
node *current=head;
node *newnode=new node;
if(newnode==NULL)
throw(key);
newnode->data=key;
int height=0;
if(head==0){
head=newnode;
}
else
{
while(1){
if(current->right==NULL && current->data < newnode->data)
{
current->right=newnode;
height++;
break;
}
else …Run Code Online (Sandbox Code Playgroud)