B1TW153
Badgerwise?:O
I randomly made this for a friend, since he didn't really understand the concept. I'm posting it here today to see if anyone can tell me how I could do it better.
If you want to look at the app;
https://www.virustotal.com/en/file/...fd55458f1b4183d8d4e76ab2a29d5d87265/analysis/
If you want to look at the app;
https://www.virustotal.com/en/file/...fd55458f1b4183d8d4e76ab2a29d5d87265/analysis/
Code:
#include "stdafx.h"
#include <iostream>
#include<Windows.h>
#include<LMCons.h>
#include <typeinfo>
using namespace std;
namespace App
{
short result; int bytes;
char*az[] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
char*thing[] = { "char","int","short","long","long long","float","double","boolean", "char*" };
enum : int { CHAR, INT, SHORT, LONG, LONG_LONG, FLOAT, DOUBLE, BOOLEAN, STRING };
}
void printInfo(char*data = App::thing[App::result-1])
{
if(!stricmp(data,App::thing[App::CHAR])) App::bytes = sizeof(char);
if(!stricmp(data,App::thing[App::INT])) App::bytes = sizeof(int);
if(!stricmp(data,App::thing[App::SHORT])) App::bytes = sizeof(short);
if(!stricmp(data,App::thing[App::LONG])) App::bytes = sizeof(long);
if(!stricmp(data,App::thing[App::LONG_LONG])) App::bytes = sizeof(__int64);
if(!stricmp(data,App::thing[App::FLOAT])) App::bytes = sizeof(float);
if(!stricmp(data,App::thing[App::DOUBLE])) App::bytes = sizeof(double);
if(!stricmp(data,App::thing[App::BOOLEAN])) App::bytes = sizeof(bool);
if(!stricmp(data,App::thing[App::STRING])) App::bytes = sizeof(char*);
cout << App::bytes << "Bytes are in a " << App::thing[App::result-1] << endl << App::bytes * 8 << "Bits are in a " << App::thing[App::result-1];
}
void Main()
{
cout << "#Bitwise WARNING: Only enter integers!" << endl << endl;
cout << "1. Char\n2. Int\n3. Short\n4. Long\n5. Long Long\n6. Float\n7. Double\n8. Boolean\n9. String" << endl;
cout << "Select your option [1-9]; > ";
cin >> App::result;
if(App::result <= 9 && App::result > 0 && !strcmp(typeid(App::result).name(), "short")){
cin.ignore();
system("cls");
cout << "You selected " << App::thing[App::result-1] << endl;
cout << "\n\tGenerating Information on " << App::thing[App::result-1] << "..." << endl;
Sleep(2000);
printInfo();
cin.get();
system("cls");
Main();}
else
cout << "Wrong option Selected!" << endl;
Sleep(260);
system("cls");
App::result &= ~App::result;
Main();
}
int _tmain(int argc, _TCHAR* argv[])
{
SetConsoleTitle(L"\tBits'N'Bytes");
Main();
}
Last edited: