Minggu, 07 Desember 2025

listing3.4.cpp unsigned & signed short + 1

// listing3.4.cpp
#include <iostream>
using namespace std;

int main()
{
    unsigned short uShortValue=65535;
    cout << "unsigned short 65535 + 1 = ";
    cout << ++uShortValue << endl;

    short signedShort=32767;
    cout << "signed short 32767 + 1 = ";
    cout << ++signedShort << endl;

    return 0;
}

output:
 
unsigned short 65535 + 1 = 0
signed short 32767 + 1 = -32768

Process returned 0 (0x0)   execution time : 0.398 s
Press any key to continue.

Tidak ada komentar:

Posting Komentar