CPP 16
Goto and const Guest on 19th January 2024 02:47:45 AM
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     //defines a constant that cannot be re-assigned  
  8.     const string school = "CCBC";
  9.     cout << "Welcome ";
  10.     //skips to the label
  11.     goto myLabel;
  12.     cout << "to ";
  13.     myLabel:
  14.     //the next line would cause an error because school is a constant
  15.     //school = "UMBC";
  16.     cout << school;
  17. }

Paste is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.