#include <QInputDialog>
#include <QPushButton>
#include <QGridLayout>
int main(int argc, char *argv[]) //window::connect
{
QApplication app(argc, argv);
QPushButton *button1 = new QPushButton("1");
QPushButton *button2 = new QPushButton("2");
QPushButton *button3 = new QPushButton("3");
QPushButton *button4 = new QPushButton("4");
QPushButton *button5 = new QPushButton("5");
QPushButton *button6 = new QPushButton("6");
QPushButton *button7 = new QPushButton("7");
QPushButton *button8 = new QPushButton("8");
QPushButton *button9 = new QPushButton("9");
QWidget *window = new QWidget;
QGridLayout *layout = new QGridLayout;
QInputDialog *pq=new QInputDialog;
layout->addWidget(pq);
layout->addWidget(button1);
layout->addWidget(button2);
layout->addWidget(button3);
layout->addWidget(button4);
layout->addWidget(button5);
layout->addWidget(button6);
layout->addWidget(button7);
layout->addWidget(button8);
layout->addWidget(button9);
QObject :: connect (button1,SIGNAL(clicked()), button1,SLOT(showMenu ()));
window->setLayout(layout);
window->show();
return app.exec();
主页
/
user-354417
Razor0109's questions
例如,如果我在类构造函数中为数组分配内存,是否可以稍后在没有构造函数外部的析构函数的情况下释放它?
class Myclass
{
public:
int* data;
Myclass(int size)
{
data = new int[size];
cout << data << "конструктор вызвался";
for (int i=0;i<size;i++)
{
data[i]=i;
}
}
};
char ch;
cin.get(ch);
cout << ch+1;
为什么他会这么cout
认为?如果没有。ch
int
++ch