Jump to content
wikedx

rescriere structura for din algoritm in c++

Recommended Posts

  • Active Members

In principiu ai in cazul general:

FOR i = val.initial, val.finala, pas 

Deci in cazul tau ar veni cam asa:


for(x=a;x<=b;x--){
//ceva_de_executat;
}

Pasii vor fi urmatorii:

  1. Initializarea lui x cu valoarea lui a
  2. Cat timp x<=b
  3. Efectuam ceva_de_executat
  4. Efectuam x = x-1

Instructiunile 1,2 si 4 iti arata de fapt ce se intampla in for

Link to comment
Share on other sites

Salut nu imi dau seama cum sa scriu si eu o structura din algoritm in c++.

Vreau sa scriu in c++ deoarece asa stiu sa rezolv si imi e mai usor.

258tawh.png

Doar ca si o observatie adiacenta; acela este pseudocod, nu "algoritm", in literatura de specialitate.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...