VEXcode Pro V5-ൽ പാരാമീറ്ററുകൾ ഉപയോഗിച്ച് ഒരു Void ഫംഗ്ഷൻ എഴുതുന്നു.

The VEX Visual Studio Code Extension has replaced VEXcode Pro V5, which is now end-of-life.

VEXcode Blocks and VEXcode Text remain actively developed and supported for all VEX platforms.

ചില സമയങ്ങളിൽ ഫംഗ്ഷനെക്കുറിച്ച് ചില പ്രത്യേക വിവരങ്ങൾ നൽകാൻ നിങ്ങൾ ആഗ്രഹിക്കുന്നുണ്ടാകും. ഇത് ഓരോ തവണ വിളിക്കുമ്പോഴും ലഭിക്കുന്ന വിവരങ്ങളെ അടിസ്ഥാനമാക്കി ഫംഗ്‌ഷന് അതിന്റെ ചുമതല നിർവഹിക്കാൻ അനുവദിക്കും. ഇത് എങ്ങനെ പ്രവർത്തിക്കുന്നുവെന്ന് ഇനിപ്പറയുന്ന സാമ്പിൾ കാണിക്കും.


മാതൃക: പാരാമീറ്ററുകൾ ഉപയോഗിച്ച് കാണിക്കുന്നതിനായി ഒരു പ്രോഗ്രാം ഒരു സ്മൈലി ഫെയ്സ് വരയ്ക്കുന്നു.

താഴെ കൊടുത്തിരിക്കുന്ന ഉദാഹരണം ശരിയായി ഉപയോഗിക്കുന്ന ആഗോള വേരിയബിളുകളെ ഉദാഹരണമായി കാണിക്കുന്നു.

ഉപയോക്തൃ-നിർവചിത ഫംഗ്ഷൻ ഉപയോഗിക്കാതെ:

int MaxX = 484, MaxY = 278;

int main() { 
  vexcodeInit();

  int centerX = MaxX/2, centerY = MaxY/2;

  //മുഖം
	Brain.Screen.drawCircle(centerX, centerY, 100);

  //ഇടത് കണ്ണ്
  int space = 20; /*ഇത് സ്ക്രീനിന്റെ മുകൾ ഭാഗവുമായി ബന്ധപ്പെട്ട് കണ്ണിനുള്ള സ്പേസിംഗ് നൽകുന്നു. നിങ്ങൾക്ക് ഇത് എങ്ങനെ വേണമെങ്കിലും ക്രമീകരിക്കാം.*/
  centerX = MaxX/2+space;
  centerY = MaxY/2-30;
  Brain.Screen.drawCircle(centerX, centerY, 20);

  //വലത് കണ്ണ്  
  /*...വലത് കണ്ണിനുള്ള കോഡ് നിങ്ങൾക്ക് ഇവിടെ തുടരാം*/

  //സ്മൈലി മൗത്ത്
  /*...സ്മൈലി മൗത്തിന്റെ കോഡ് നിങ്ങൾക്ക് ഇവിടെ തുടരാം
    ... മുതലായവ.
    നിങ്ങൾക്ക് മറ്റൊരു വലുപ്പം വരയ്ക്കണമെങ്കിൽ, മുഴുവൻ കോഡുകളും വീണ്ടും ആവർത്തിക്കേണ്ടിവരും.
    */
}

ഉപയോക്താവ് നിർവചിച്ച ഫംഗ്ഷൻ ഉപയോഗിച്ച്:

int MaxX = 484, MaxY = 278;
const char Left=1, Right=2;

void drawFace(int size){
  /*...code for the size parameter from caller funciton.*/

}

//side == Left or Right
void drawEye(char side){
  /*...code for the size parameter of the eyes from caller funciton.*/
}

//side == Left or Right
void drawMouth(bool smile, int size){
  /*...cooler from caller from size parameter of the caller. ഇതിൽ പുഞ്ചിരിക്കണോ അതോ മുഖം ചുളിക്കണോ എന്നതും വീതിയും ഉൾപ്പെടുന്നു.*/
}

int main() { 
  vexcodeInit();

  drawFace();
  drawEye(ഇടത്);
  drawEye(വലത്);

  //ഇതുപയോഗിച്ച് നിങ്ങൾക്ക് ശരിക്കും ആസ്വദിക്കാം...
  while (true){
    drawMouth(true, 30);
    wait(1000, msec);
    drawMouth(false, 30);
    wait(1000, msec);
  }  
}

കോളർ ഫംഗ്ഷൻ main() ൽ നിന്നുള്ള ലോജിക് ഫ്ലോയുടെ ക്രമം ഇവിടെ കാണിക്കുന്നു:

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: