意外发现布达佩斯美术博物馆有Renoir的临展,很是不错。特别喜欢他的光影细节。还看到了Raphael 和 Titan的一点点。
喜欢Renoir所说,That’s where I found models who were willing to lend me their youth and grace for a while.
在馆内的时候貌似下了大雨,出门更美了。 https://t.cn/A6tCdMfB
喜欢Renoir所说,That’s where I found models who were willing to lend me their youth and grace for a while.
在馆内的时候貌似下了大雨,出门更美了。 https://t.cn/A6tCdMfB
Sunsets are free, so are spring, summer, autumn and winter. Don't feel that life is hopeless. I hope you are happy. We always rush for many things that are far away, but we forget the flowers on the roadside and the sunset that falls on us in the evening. While busy living, remember to feel the small details of daily life. In addition to trivial and insipid life, there are delicious food and countless blooming flowers.
——链栈的实现和使用
#include
using namespace std;
template
struct Node { //结点
DataType data; //数据域
Node* next;//指针域
};
template
class LinkStack {
public:
LinkStack();
~LinkStack();
void Push(DataType x);
DataType Pop();
DataType GetTop();
int Empty();
private:
Node * top; //栈顶指针即链栈的头指针
};
template
LinkStack::LinkStack()
{
top = new Node;
top->next = nullptr;
}
template
LinkStack::~LinkStack()
{
Node* q = nullptr;
while (top != nullptr) {
q = top;
top = top->next;
delete q;
}
}
template
void LinkStack::Push(DataType x)
{
Node* s = nullptr;
s = new Node; s->data = x;
s->next = top; top = s;
}
template
DataType LinkStack::Pop()
{
Node* p = nullptr;
DataType x;
if (top == nullptr)throw"下溢";
x = top->data;p = top;
top = top->next;
delete p;
return x;
}
template
DataType LinkStack::GetTop()
{
if (top == nullptr )throw"下溢异常";
else
return top->data;
}
template
int LinkStack::Empty()
{
if (top==nullptr)return 1;
else return 0;
}
int main() {
int x;
LinkStackS{};
cout << "对15和10执行入栈操作,";
S.Push(15); S.Push(10);
cout << "当前栈顶元素为:" << S.GetTop() << endl;
try {
x = S.Pop();
cout << "执行一次出栈操作,删除元素" << x << endl;
}
catch (char* str) { cout << str << endl; }
try {
cout << "请输入待插入元素:";
cin >> x;
S.Push(x);
}
catch (char* str) { cout << str << endl; }
if (S.Empty() == 1)cout << "栈为空" << endl;
else {
cout << "栈非空" << endl;
cout << "当前栈顶元素为:" << S.GetTop() << endl;
}
return 0;
}
#include
using namespace std;
template
struct Node { //结点
DataType data; //数据域
Node
};
template
class LinkStack {
public:
LinkStack();
~LinkStack();
void Push(DataType x);
DataType Pop();
DataType GetTop();
int Empty();
private:
Node
};
template
LinkStack
{
top = new Node
top->next = nullptr;
}
template
LinkStack
{
Node
while (top != nullptr) {
q = top;
top = top->next;
delete q;
}
}
template
void LinkStack
{
Node
s = new Node
s->next = top; top = s;
}
template
DataType LinkStack
{
Node
DataType x;
if (top == nullptr)throw"下溢";
x = top->data;p = top;
top = top->next;
delete p;
return x;
}
template
DataType LinkStack
{
if (top == nullptr )throw"下溢异常";
else
return top->data;
}
template
int LinkStack
{
if (top==nullptr)return 1;
else return 0;
}
int main() {
int x;
LinkStack
cout << "对15和10执行入栈操作,";
S.Push(15); S.Push(10);
cout << "当前栈顶元素为:" << S.GetTop() << endl;
try {
x = S.Pop();
cout << "执行一次出栈操作,删除元素" << x << endl;
}
catch (char* str) { cout << str << endl; }
try {
cout << "请输入待插入元素:";
cin >> x;
S.Push(x);
}
catch (char* str) { cout << str << endl; }
if (S.Empty() == 1)cout << "栈为空" << endl;
else {
cout << "栈非空" << endl;
cout << "当前栈顶元素为:" << S.GetTop() << endl;
}
return 0;
}
✋热门推荐