コード例 #1
0
ファイル: main.c プロジェクト: JamalK/Tutorials-Stuff
int main(int argc, const char * argv[])
{
   float radius =5;
    double area;
    areaCircle(radius, &area);
    printf("the are of %f radius circle is %f .\n",radius,area);
    
    
   
    
    
    return 0;
}
コード例 #2
0
void circleMenu(Circle** cir) {
  int option;
  do {
    cout <<
      "\n  CIRCLE MENU                             "
      "\n    1. Create two Circle objects          "
      "\n    2. Compare by volume                  "
      "\n    3. Compare by area                    "
      "\n    4. Print two Circle objects           "
      "\n    5. Quit                               ";

    cout << "\n  Enter your option (1 to 5): ";
    cin >> option;

    switch (option) {
    case 1:
      delete *cir;
      *cir = 0;
      *cir = new Circle[2];
      cout << "\n    Cricle #1:" << endl;
      cin >> (*cir)[0];
      cout << "\n    Cricle #2:" << endl;
      cin >> (*cir)[1];
      break;
    case 2:
      if (cir != 0)
        cout << "\n    The circle has 0 volume." << endl;
      else
        cout << "\n    Cricle ojbects are not fully available." << endl;
      break;
    case 3:
      areaCircle(*cir);
      break;
    case 4:
      if (*cir != 0) {
        cout << "\n    Circle #1:" << endl;
        cout << (*cir)[0];
        cout << "\n    Circle #2:" << endl;
        cout << (*cir)[1];
      } else {
        cout << "\n    Cirlce ojbects are not fully available." << endl;
      }
      break;
    case 5:
      break;
    default:
      cout << "\n    Wrong Option!" << endl;
    }
  } while (option != 5);
}
コード例 #3
0
void mixedMenu(Rectangle* rec, Circle* cir) {
  int option;
  do {
    cout <<
      "\n  MIXED MENU                                 "
      "\n    1. Compare by area                       "
      "\n    2. Compare by volume                     "
      "\n    3. Print ALL objects                     "
      "\n    4. Quit                                  ";

    cout << "\n  Enter your option (1 to 4): ";
    cin >> option;

    switch (option) {
    case 1:
      areaRectangle(rec);
      areaCircle(cir);
      break;
    case 2:
      cout << "\n    Rectangle and Cirlce has 0 volume" << endl;
      break;
    case 3:
      if (rec != 0) {
        cout << rec[0];
        cout << rec[1];
      } else {
        cout << "\n    Rectangle ojbects are not fully available." << endl;
      }
      if (cir != 0) {
        cout << cir[0];
        cout << cir[1];
      } else {
        cout << "\n    Cirlce ojbects are not fully available." << endl;
      } break;
    case 4:
      break;
    default:
      cout << "\nWrong Option!" << endl;
    }
  } while (option != 4);
}