Advertisement
2002C Debugging and Error Handling #16477

Beginning C++ 4

This just for beginners. It shows how variables can exist in different scopes

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
//this program shows that variables can exist
//in different scopes and can be called on
//a peice of code within that scope

#include <iostream.h>
void main()
{
  char ch = 'A';
  cout << "Tier " << ch << '\n';
  {
   char ch = 'B';
   cout << "Tier " << ch << '\n';
   {
     char ch = 'C';
     cout << "Tier " << ch << '\n';
   }
   cout << "Tier " << ch << '\n';
  }
  cout << "Tier " << ch << '\n';
}
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine