cool program

i found a cool program that reads the bytes of int and more on your computer!


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>

 int main()
 {
    using std::cout;
 
    cout << "The size of an int is:\t\t"    
       << sizeof(int)    << " bytes.\n";
    cout << "The size of a short int is:\t" 
       << sizeof(short)  << " bytes.\n";
    cout << "The size of a long int is:\t"  
       << sizeof(long)   << " bytes.\n";
    cout << "The size of a char is:\t\t"    
       << sizeof(char)   << " bytes.\n";
    cout << "The size of a float is:\t\t"   
        << sizeof(float)  << " bytes.\n";
    cout << "The size of a double is:\t"    
       << sizeof(double) << " bytes.\n";
    cout << "The size of a bool is:\t\t"      
       << sizeof(bool)   << " bytes.\n";
    cout << "The size of a cout is:\t\t"
       << sizeof(cout)    << " bytes.\n";
    
    system("PAUSE");
 }


sorry i used system("PAUSE") but that is the only code that actually works on Dev-C++

cin.get(); not work

getche(); not work

1
2
std::cout << "Press ENTER to continue...";          not work               
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );


sleep(5); not work

cin.ignore( numeric_limits<streamsize>, '\n' ); not work
I just facepalmed myself...
im a total beginner so if i did anything wrong tell me
I just don't understand what the question is... Or why you even bothered to post this program... If you're a beginner go read the tutorial on this site. It's very useful.
P.S: cin.get() does work, cin.ignore() works.. basically everything works... except the sleep(5)... because it's Sleep(5); <- notice the capital S
Last edited on
are you asking a question or just sharing your code? anyway sleep(5) should be capital S
Sleep (capital S) on Windows
sleep (lowercase S) on Unix (POSIX API)
oh i see.. sorry about that, i'm a windows user.
That went without saying.
Topic archived. No new replies allowed.