⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comple_n_runtime_checks.adb.npp

📁 This contains the following topics and more ADA versus C and Cplus plus Ada_training ADA 2005 for
💻 NPP
字号:
--Compile-time and run-time checks
with Text_IO; use Text_IO;
procedure comple_n_runtime_checks is
   type Power_Points is range 0 .. 6;
   type Room_Size is range 0 .. 120;
   subtype Lecture_Room is Room_Size range 0 .. 75;
   subtype Tutorial_Room is Room_Size range 0 .. 20;
   Points_In_504 : Power_Points; --Power outlets
   People_In_504 : Lecture_Room; --Size lecture room
   People_In_616 : Tutorial_Room; --Size tutorial room
begin
   Points_In_504 := 3; --OK
   --Points_In_504 := 80; --compile time Error / Warning --out of range
   People_In_504 := 15; --OK
   People_In_616 := People_In_504; --OK
   --People_In_504 := Points_In_504; -- Type Mismatch subtype cannot eqaute 2 type
				     -- compile time error
   People_In_504 := Lecture_Room (Points_In_504); --Force
   People_In_504 := 50; --OK
   People_In_616 := People_In_504; --Constraint error -- run time error
end comple_n_runtime_checks;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -