I typed two examples for "Hello World" program, one using "cout" but doesn't print anything, and the other by using "qDebug()" and printed the words, why "cout doesn't work?
#include <QCoreApplication>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout << "Hello World!";
return a.exec();
}
#include <QCoreApplication>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
cout << "Hello World!";
return a.exec();
}
To copy to clipboard, switch view to plain text mode
#include <QCoreApplication>
#include <iostream>
#include <QDebug>
using namespace std;
int main(int argc, char *argv[])
{
//cout << "Hello World!";
qDebug() << "Hello World!";
return a.exec();
}
#include <QCoreApplication>
#include <iostream>
#include <QDebug>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
//cout << "Hello World!";
qDebug() << "Hello World!";
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks