Application langage C pour le calcul des unités
Application langage C pour le calcul des unités
Cet article propose en détaille une application en langage C pour le calcul des unités, elle contient des formules pour calculer le nombre de poutrelle, l'hourdis, PTS, m², ml
Vous pourrez télécharger le fichier au format zip il contient le code sources complet et les images.
Extrait du code :
#include "login.h"
#include "ui_login.h"
#include <QMessageBox>
#include <windows.h>
Login::Login(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Login)
{
ui->setupUi(this);
mydatabase= QSqlDatabase::addDatabase("QSQLITE");
mydatabase.setDatabaseName("C:/Users/mahdi/Desktop/MyApplication/My_Application/LOGIN.sqlite");
if(!mydatabase.open())
mydatabase.open();
}
Login::~Login()
{
delete ui;
}
void Login::on_Annuler_clicked()
{
this->hide();
}
void Login::on_Connexion_clicked()
{
QString username,password;
username=ui->lineEdit_username->text();
password=ui->lineEdit_password->text();
QSqlQuery quer;
if(quer.exec(" select * from login where Username='"+username+"' and Password='"+password+"'"))
{
int count=0;
while(quer.next())
{count++;}
if(count==1)
{
this->hide();
F=new FirstPage;
F->show();
}
else
QMessageBox::warning(this,tr("Warning"),tr("Nom d'utilisateur ou Mot de pass est incorrect!!"));
}
}
… … …
#include "firstpage.h"
#include "ui_firstpage.h"
FirstPage::FirstPage(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::FirstPage)
{
ui->setupUi(this);
}
FirstPage::~FirstPage()
{
delete ui;
}
void FirstPage::on_Potrelle_clicked()
{
int P;
P=(ui->V->value())/0.62;
ui->lineEdit->setText(QString::number(P));
}
void FirstPage::on_METRE_LINEAIRE_clicked()
{
float ml;
int P;
P=(ui->V->value())/0.62;
ml=(ui->A->value())*P;
ui->lineEdit_2->setText(QString::number(ml));
}
void FirstPage::on_pushButton_3_clicked()
{
float M;//metrre carre
M=(ui->A->value())*(ui->V->value());
ui->lineEdit_3->setText(QString::number(M));
}
void FirstPage::on_pushButton_4_clicked()
{
float PTS,PTS_tmp;
float M;//metrre carre
M=(ui->A->value())*(ui->V->value());
PTS=M/10;
PTS_tmp=PTS;
while(PTS>1)
PTS--;
if(PTS>=0.7)
PTS_tmp+=1-PTS;
else
PTS_tmp+=-PTS;
ui->lineEdit_4->setText(QString::number(PTS_tmp));
}
void FirstPage::on_pushButton_5_clicked()
{
int nbr_d_lwardi=0;
float M;//metrre carre
M=(ui->A->value())*(ui->V->value());
nbr_d_lwardi=8.22*M;
while(nbr_d_lwardi%5!=0 && nbr_d_lwardi%10!=0)
{
nbr_d_lwardi++;
}
ui->lineEdit_5->setText(QString::number(nbr_d_lwardi));
}
void FirstPage::on_commandLinkButton_clicked()
{
F = new FirstPage(this);
F->show();
}
… … …
#include "login.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Login w;
w.show();
return a.exec();
}