int main(int argc, char *argv[]) { struct L *p = NULL; struct L *head; int i; for (i = 0; i < 10; i++) { if (!p) { p = (struct L *)malloc(sizeof(struct L)); head = p; p->v = i; p->next = NULL; } else { p->next = (struct L *)malloc(sizeof(struct L)); p = p->next; p->v = i; p->next = NULL; } } showL(head); addvalue(head, 10); printf("After add, list L is:\n"); showL(head); exit(0); }
int main(int argc, char *argv[]) { char *nomeArquivo = argv[1]; FILE *arq = fopen(nomeArquivo, "r"); int num = 0; int number, number2; fread(&number2, sizeof(number2), 1, arq); while( !feof(arq) ) { fread(&number, sizeof(number), 1, arq); num++; if(number < number2) { showL("Erro! Lista não ordenada!", RED); return 0; } } show("Lista ordenada! ", GREEN); show(num, GREEN); showL(" elementos ", GREEN); fclose(arq); return 0; }
Menu::Menu(QWidget *parent) : defaultScreenWidth(480), defaultScreenHeight(800), QMainWindow(parent) { setAttribute(Qt::WA_DeleteOnClose); central = new QWidget(this); central->setObjectName("central"); windowTitle = new QLabel; windowTitle->setScaledContents(true); AButton = new QPushButton(tr("Сложение")); AButton->setFocusPolicy(Qt::NoFocus); connect(AButton, SIGNAL(clicked()), this, SLOT(showA())); BButton = new QPushButton(tr("Вычитание")); BButton->setFocusPolicy(Qt::NoFocus); connect(BButton, SIGNAL(clicked()), this, SLOT(showB())); CButton = new QPushButton(tr("Умножение на число")); CButton->setFocusPolicy(Qt::NoFocus); connect(CButton, SIGNAL(clicked()), this, SLOT(showC())); DButton = new QPushButton(tr("Умножение")); DButton->setFocusPolicy(Qt::NoFocus); connect(DButton, SIGNAL(clicked()), this, SLOT(showD())); EButton = new QPushButton(tr("Транспонирование")); EButton->setFocusPolicy(Qt::NoFocus); connect(EButton, SIGNAL(clicked()), this, SLOT(showE())); FButton = new QPushButton(tr("Определитель")); FButton->setFocusPolicy(Qt::NoFocus); connect(FButton, SIGNAL(clicked()), this, SLOT(showF())); GButton = new QPushButton(tr("Возведение в степень")); GButton->setFocusPolicy(Qt::NoFocus); connect(GButton, SIGNAL(clicked()), this, SLOT(showG())); HButton = new QPushButton(tr("Обратная матрица")); HButton->setFocusPolicy(Qt::NoFocus); connect(HButton, SIGNAL(clicked()), this, SLOT(showH())); IButton = new QPushButton(tr("След")); IButton->setFocusPolicy(Qt::NoFocus); connect(IButton, SIGNAL(clicked()), this, SLOT(showI())); JButton = new QPushButton(tr("Треугольный вид")); JButton->setFocusPolicy(Qt::NoFocus); connect(JButton, SIGNAL(clicked()), this, SLOT(showJ())); KButton = new QPushButton(tr("Ранг")); KButton->setFocusPolicy(Qt::NoFocus); connect(KButton, SIGNAL(clicked()), this, SLOT(showK())); LButton = new QPushButton(tr("Определенность матрицы")); LButton->setFocusPolicy(Qt::NoFocus); connect(LButton, SIGNAL(clicked()), this, SLOT(showL())); settingsButton = new QPushButton(tr("Настройки")); settingsButton->setFocusPolicy(Qt::NoFocus); connect(settingsButton, SIGNAL(clicked()), this, SLOT(showSettings())); scaling(); designInit(); sizeInit(); init(); setCentralWidget(central); setWindowTitle(tr("Матричный калькулятор++")); }