Hi ALl,
I cannot run consol based application using Qt creator. Plz tell me if my procedure is wrong. Below also i've pasted snipset of my code.
1. open new project
2. select Qt console based application.
3. write the code.
Its not recognising std library functions.
//#include <QtCore/QCoreApplication>
#include <iostream>
using namespace std;
//int main(int argc, char *argv[])
//{
// QCoreApplication a(argc, argv);
//
// return a.exec();
//}
#include <stdio.h>
void dec_bin(int number);
int main(void)
{
int input = 0;
printf("Digit (0-255): ");
scanf("%d", &input);
(input >= 0) && (input < 256) ? dec_bin(input) : std::exit(1);
return 0;
}
void dec_bin(int number)
{
int x, y;
x = y = 0;
for(y = 7; y >= 0; y--)
{
x = number / (1 << y);
number = number - x * (1 << y);
printf("%d", x);
}
printf("\n");
}
//#include <QtCore/QCoreApplication>
#include <iostream>
using namespace std;
//int main(int argc, char *argv[])
//{
// QCoreApplication a(argc, argv);
//
// return a.exec();
//}
#include <stdio.h>
void dec_bin(int number);
int main(void)
{
int input = 0;
printf("Digit (0-255): ");
scanf("%d", &input);
(input >= 0) && (input < 256) ? dec_bin(input) : std::exit(1);
return 0;
}
void dec_bin(int number)
{
int x, y;
x = y = 0;
for(y = 7; y >= 0; y--)
{
x = number / (1 << y);
number = number - x * (1 << y);
printf("%d", x);
}
printf("\n");
}
To copy to clipboard, switch view to plain text mode
Thank you all.
Bookmarks