Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
unsigned int, Cardinal, and UINT
The unsigned int, its Borland redefined Cardinal, and the Win32 UINT, data types are used to identify a 32-bit positive integer variable whose value would range from 0 to 2147484647.
C++ Builder provides an effective checking process when you use the Cardinal or the USHORT, which improves the code. For example, if the user (or the program) is supposed to provide a positive number, such as the count of students in a classroom, but provides anything else than a positive integer, the compiler would reset the value of the variable to 1; consequently, no error (called exception) would be raised. Therefore, when writing a program, it is safer to declare a positive integer as Cardinal or USHORT.
//---------------------------------------------------------------------------
#include <vcl.h>
#include <iostream.h>
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
unsigned int Books;
Cardinal NbrOfToes;
USHORT NbrOfPeople;
cout << "Estimate the number of books you have: ";
cin >> Books; cout << "How many toes does a porc have? ";
cin >> NbrOfToes;
cout << "Enter the number of people who live with you: ";
cin >> NbrOfPeople;
cout << "\nYou have a collection of " << Books << " books";
cout << "\nFrom the information you supplied, a porc has "
<< NbrOfToes << " toes.";
cout << "\nYou live in a house of " << NbrOfPeople << " people.";
cout << "\n\nPress any key to continue...";
getchar();
return 0;
}
//---------------------------------------------------------------------------
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.