giorgik
19th June 2012, 16:19
Hello everyone, I was studying the use of namespaces and tried to take a simple example, which in part works but the process is suspended, not closed.
First things first, this is my example:
geometria.h
#ifndef GEOMETRIA_H
#define GEOMETRIA_H
namespace Geometria {
float Norma(int i) {
float risultato = (float)i/6;
return risultato;
}
}
#endif // GEOMETRIA_H
main.cpp
#include <QCoreApplication>
#include <iostream>
#include "geometria.h"
using namespace std;
using namespace Geometria;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
float ris = Norma(3);
cout << "Il risultato è: " << ris << endl;
return a.exec();
}
When I launch the program, I see the result in Qt-Creator 2.5.0 but the program does not close, I have to do it by CTRL + ALT + DEL.
Can you tell me where I went wrong?
First things first, this is my example:
geometria.h
#ifndef GEOMETRIA_H
#define GEOMETRIA_H
namespace Geometria {
float Norma(int i) {
float risultato = (float)i/6;
return risultato;
}
}
#endif // GEOMETRIA_H
main.cpp
#include <QCoreApplication>
#include <iostream>
#include "geometria.h"
using namespace std;
using namespace Geometria;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
float ris = Norma(3);
cout << "Il risultato è: " << ris << endl;
return a.exec();
}
When I launch the program, I see the result in Qt-Creator 2.5.0 but the program does not close, I have to do it by CTRL + ALT + DEL.
Can you tell me where I went wrong?