#include<iostream>
#include<cstdlib>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
setlocale(LC_ALL, "pl-PL");
string text;
char wybor;
do
{
//MENU
cout << "Jakie typu zmiennych chcesz sprawdzić( ile zajmuje pamięci) : \n1 - int \n2 - bool \n3 - char \n4 - unsigned char \n5 - wchar_t \n6 - short \n7 - unsigned short \n8 - long \n9 - unsigned long \n10 - long long \n11 - float \n12 - double \n13 - long double \n14 - unsigned int \n15 - unsigned long long " << endl;
cin >> wybor;
cin.sync();
cin >> text;
wybor = text[0];
switch (wybor)
{
case '1':
{
cout << "Typ int zajmuje " << sizeof(int) << "b\n";
break;
}
case '2':
{
cout << "Typ bool zajmuje: " << sizeof(bool) << "b\n";
break;
}
case '3':
{
cout << "Typ char zajmuje: " << sizeof(char) << "b\n";
break;
}
case '4':
{
cout << " Typ unsigned char zajmuje: " << sizeof(unsigned char) << "b\n";
break;
}
case '5':
{
cout << " Typ wchar_t zajmuje: " << sizeof(wchar_t) << "b\n";
break;
}
case '6':
{
cout << " Typ short zajmuje: " << sizeof(short) << "b\n";
break;
}
case '7':
{
cout << " Typ unsigned short zajmuje: " << sizeof(unsigned short) << "b\n";
break;
}
case '8':
{
cout << "Typ long zajmuje: " << sizeof(long) << "b\n";
break;
}
case '9':
{
cout << "Typ unsigned long zajmuje: " << sizeof(unsigned long) << "b\n";
break;
}
case '10':
{
cout << "Typ long long zajmuje: " << sizeof(long long) << "b\n";
break;
}
case '11':
{
cout << "Typ float zajmuje: " << sizeof(float) << "b\n";
break;
}
case '12':
{
cout << "Typ double zajmuje: " << sizeof(float) << "b\n";
break;
}
case '13':
{
cout << "Typ long double zajmuje: " << sizeof(long double) << "b\n";
break;
}
case '14':
{
cout << "Typ unsigned int zajmuje: " << sizeof(unsigned int) << "b\n";
break;
}
case '15':
{
cout << "Typ unsigned long long zajmuje: " << sizeof(unsigned long long) << "b\n";
}
case '16':
cout << " Wybrałeś spróbuj ponownie" << endl;
}
} while (wybor > '17');
//cout << "Można też sprawdzić podając nazwę zmiennej " << sizeof(a) << "b\n";
//int tab[1000];
//cout << "Ta tablica zajmuje " << sizeof(tab) << "b\n";
system("pause");
}
//return 0;
Replies to Houston, we have a problem
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}