Ich lerne Programmieren!

      Ich lerne Programmieren!

      Hey,
      Ich lerne gerade Programmieren.
      Und habe HTML schon gelernt und jetzt will ich .exe lernen und ich frage mich wenn man halt die .exe startet...
      Ahh ich habs wie beim UHG dann kommt ja
      D = Zusammenstellung vom UHG
      . =...................................
      . =...................................
      Was muss man in der .txt schreiben damit in der .exe DAS kommt ?
      Und wie macht man dann wenn ich D drücke werden die Sachen ja gelanden ohne das man ständig Downloaden Downloaden Downloaden drücken muss wie geht das das der dann den LINK durchsucht und die Datei downloaded dass ...
      MfG

      Das ist nicht .exe lernen sondern .bat. Der UHG-Downlaoder wurde einfach nur in eine exe umgewandelt.
      Das mit dem drücken ist so:
      Da erklärt man erst was passiert was man drückt, z.B. D und dann kommt
      set /p EINGABE=
      if "%EINGABE%"=="D" goto :daten

      Dann kommt

      :daten
      nusd 0001000148414450 1024 packwad
      mkdir COPY_TO_SD
      move Opera.wad COPY_TO_SD

      oder so ähnlich, ist natürlich viel umfangreicher

      EDIT:
      IOS downloaden geht mit nusd
      Daten downloaden geht mit wget
      1. HTML ist KEINE Programmiersprache, HTML ist eine Markup-Sprache. Damit wird quasi nichts anderes definiert als auf dem Bildschirm anzuzeigende Elemente. Jegliche wichtige Elemente für Programmierung im eigentlichen Sinn fehlen, bspw. Schleifen, Funktionen, Variablen, Bedingungen...


      2. Aus *.txt wird nicht so einfach eine *.exe. Der einfachste weg, aus wenig "Code" eine *.exe zu erhalten, ist m.E. ein "bat2exe"-Konverter. So kannst du ja mal eine Textdatei erstellen und sie zu *.bat umbenennen (die Endung muss "bat" lauten!). Dann schreibst du bspw.

      Quellcode

      1. @echo off
      2. echo Hallo, Test!
      3. pause
      4. exit

      in diese *.bat-Datei. Die kannst du nun auch schon ausführen, wie eine *.exe-Datei! Es handelt sich hierbei aber um eine Stapelverarbeitungsdatei, in der du mit DOS-Befehlen arbeiten kannst. Diese _kann_ mit einem Tool dann zu *.exe konvertiert werden. Allerdings ist auch das keine richtige Programmierung, kann aber hilfreich für viele Skripte und zum Erstellen von automatisierten Vorgängen sein usw. Eine Abfrage wäre z.B.

      Quellcode

      1. @echo off
      2. :start
      3. echo Wer ist der Beste?
      4. echo A: Anton
      5. echo B: Berta
      6. echo C: Cäsar
      7. echo D: Dora
      8. echo E: Emil
      9. set /P X=
      10. if /I "%X%"=="A" echo Anton ist der Beste!
      11. if /I "%X%"=="B" echo Berta ist die Beste!
      12. if /I "%X%"=="C" echo Cäsar ist der Beste!
      13. if /I "%X%"=="D" echo Dora ist die Beste!
      14. if /I "%X%"=="E" echo Emil ist der Beste!
      15. echo.
      16. echo Drücke eine Taste, um diese tolle Programm zu beenden!
      17. pause >nul
      18. exit
      Alles anzeigen

      Das wird mit dem Setzen einer Variablen X (könnten wir auch "AUSWAHL" nennen oder so) und der darauffolgenden Abfrage des Wertes von X realisiert. Per errorlevel ginge so etwas auch, ist meist auch schöner!
      Damit könntest du ja mal herumspielen. Aber richtige Programmierung würde ich auch das nicht nennen, weil z.B. Funktionen fehlen, während Bedingungen usw. schon möglich sind.


      3. Als Empfehlung, da du dich ja mit HTML schon auszukennen scheinst, würde ich dir "Javascript" ans Herz legen. Dort kannst du schon mal ein paar Dinge lernen und kommst der Syntax von Java näher, was du dann als nächstes anfangen könntest. Über diesen Weg kommt man deutlich leichter in andere Programmiersprachen, wie C++ usw., rein, da sich vielen doch stark ähneln und der strukturelle Aufbau sehr ähnlich ist.
      Auch nicht verkehrt wäre PHP, was für Anfänger sicher am leichtesten ist, da man z.B. den Variablen keinen Typ zuweisen muss, sondern sie einfach so initialisieren bzw. deklarieren kann.
      Was?Info
      ModellStandard (weiß, Release-Day)
      Zubehörinterne 500GB HDD, SDHC 32GB, LAN-Adapter, 128MB MemoryCard
      Wi-Fi SpieleWiimm's MKW Fun, Mario Kart Wii, Super Smash Bros. Brawl, ...

      Was?Info
      ModellPremium (schwarz, Release-Day)
      Zubehör500GB 2,5" HDD (schwarz), SDHC 32GB
      Wi-Fi SpieleMario Kart 8, Nintendo Land, Sonic Racing (S&ASRT), ...

      Was?Info
      Modell3DS XL (blau-schwarz)
      ZubehörSuperCard DSTwo, 4GB SDHC
      Wi-Fi SpieleMario Kart 7, ...

      Was?Code / ID
      Wiimm's MKW-Fun0904-9558-6482
      Nintendo Network IDEnting
      Nintendo 3DS5455-9634-9827


      Danke an feeder für meinen tollen Avatar!
      Wenn du unbedingt ein bisschen *.bat-Dateien programmieren willst, dann hast du hier mal ne kleine Einleitung:
      de.wikibooks.org/wiki/Batch-Programmierung:_Batch-Befehle
      Also, mal zum Thema Programmieren. Hier herrscht ja offensichtlich komplette Flaute im Land der Kompetenz. Fangen wir deshalb gaaaanz weit vorne an:
      Eine .exe-Datei ist ein ausführbares Programm. Es besteht entweder direkt aus Maschinenbefehlen und einigen Metadaten wie etwa seinem Namen, seiner Version, seinen verlinkten Libraries und und und, oder aus einem Zwischencode, dem MSIL-Code.
      Das ist etwa der Fall, wenn du für das Programm zum Ausführen das .NET-Framework benötigst.

      Nun zum Part des Programmierers: Zuerst musst du dir eine Sprache suchen. Windows, welches übrigends keine geeignete Platform ist, bietet da nur C, C++, C#, Java und einige andere Sprachen wie etwa Google Go.
      Batch ist übrigends keine Programmiersprache, sondern eine JCL, eine Job-Control-Language. Damit führst du andere Programme aus, mit denen du bestimmte Prozesse abkürzen kannst, etwa ein Backup deines ganzen Dateisystems oder sonstiges.
      Nun, da du dir eine Sprache ausgesucht hast, vergisst du diese gleich wieder. Erst lernst du Struktogramme. Diese kleinen Dinger bestehen im großen und ganzen aus einigen Blöcken: Den Befehlen, If und Loops.
      Hier haben wir mal so ein Struktogramm:
      while (a > 0) and (b > 0){...} bedeutet, die eingeschlossenen Ausdrücke werden so lange wiederholt, bis entweder a oder b kleiner oder gleich 0 sind (also einer der Ausdrücke "a > 0" und "b > 0" nicht mehr wahr ist).
      Sollte das anfangs noch der Fall sein, so wird eine Tatsache abgefragt: if (a > b){...} Also, ist a größer als b.
      Wenn ja, dann ist a jetzt das Ergebnis der Rechnung a - b, wenn nein, dann ist b das Ergebnis aus b - a.
      Das wird wiederholt, bis der Ausdruck im umschließenden while nicht mehr wahr ist.
      Nun wird abgefragt, ob b 0 ist. Wenn ja, dann wird A ausgegeben, sonst B und das Progamm ist zu ende. In C würde das so ausehen:

      Quellcode

      1. #include <stdio.h>
      2. int main(){
      3. int a = 10;
      4. int b = 300;
      5. while (a > 0 && b > 0){
      6. if(a > b){
      7. a=a-b;
      8. }
      9. else{
      10. b=b-a;
      11. }
      12. }
      13. if(b==0){
      14. printf("A: %d\n", a);
      15. }
      16. else{
      17. printf("B: %d\n", b);
      18. }
      19. return 0;
      20. }
      Alles anzeigen

      Ausgabe wäre folgendes: A: 10

      Nun lernst du weiter fleißig deine Struktogramme und dann reden wir weiter^^

      Hier mal etwas "professionellerer" Code, in Java:
      Spoiler anzeigen

      Quellcode

      1. package net.minecraft.td;
      2. import net.minecraft.src.*;
      3. /**
      4. * Abstract class which describes every Mob to appear during TowerDefense.
      5. * Please note: An EntityTDMob is <i>no</i> EntityMob. EntityMob's attack EntityPlayers by default, these don't.
      6. * @author david.stockinger
      7. *
      8. */
      9. public abstract class EntityTDMob extends EntityLiving {
      10. /**
      11. * Standard constructor for EntityTDMob's.
      12. * All living entities which appear in TowerDefense mode will inherit from this abstract class.
      13. * Please note: An EntityTDMob is <i>no</i> EntityMob. EntityMob's attack EntityPlayers by default, these don't.
      14. *
      15. * @param world The world in which the EntityTDMob exists.
      16. * @param path The Path the entity will follow.
      17. */
      18. //FIXME Support multiplayer mode
      19. public EntityTDMob(World world,PathPoint[] path) {
      20. super(world);
      21. this.path=path;
      22. this.pathToEntity=new PathEntity(path);
      23. int a=4;
      24. }
      25. /**
      26. * Updates the wanderPath to the desired coordinates.
      27. * Currently, this is the players location, but will be changed to the EntityTDMob's goal on the map.
      28. * As for now, it'S uncertin if notch's implementation explicitly points out if the path is blocked.
      29. * If so, the code to tell the EntityTDMob to destroy a tower will go here.
      30. */
      31. //TODO Check if path is blocked
      32. public void updateWanderPath()
      33. {
      34. }
      35. /**
      36. * Tells if the entities movement is ceased, therefore slowed down.
      37. * Currently only returns false, since it's unneeded at this time.
      38. * @return is movement slowed down?
      39. */
      40. //TODO implement isMovementCeased()
      41. protected boolean isMovementCeased()
      42. {
      43. return false;
      44. }
      45. /**
      46. * Is called every time the EntityTDMob is updated.
      47. * Currently, EntityTDMobs behave like EntityLivings, but this will be overridden most certainly.
      48. */
      49. @Override
      50. public void onEntityUpdate()
      51. {
      52. super.onEntityUpdate();
      53. //updateWanderPath();
      54. //faceEntity(p, 30F, 30F);
      55. }
      56. /**
      57. * Discribes the behavior of the EntityTDMob.
      58. * Somebody has to look deeper into this and add a javadoc for it.
      59. */
      60. //TODO Add a god-damn javadoc for this method
      61. protected void updateEntityActionState()
      62. {
      63. if(pathToEntity.isFinished())
      64. {
      65. this.setEntityDead();
      66. // TDMethods.spawnMob("EntityTDSheep", 1, 25, 0 ,25,TDMethods.testPathA);
      67. return;
      68. }
      69. int i = MathHelper.floor_double(boundingBox.minY + 0.5D);
      70. Vec3D vec3d = pathToEntity.getPosition(this);
      71. for(double d = width * 2.0F; vec3d != null && vec3d.squareDistanceTo(posX, vec3d.yCoord, posZ) < d * d;)
      72. {
      73. pathToEntity.incrementPathIndex();
      74. if(pathToEntity.isFinished())
      75. {
      76. vec3d = null;
      77. } else
      78. {
      79. vec3d = pathToEntity.getPosition(this);
      80. }
      81. }
      82. isJumping = false;
      83. if(vec3d != null)
      84. {
      85. double d1 = vec3d.xCoord - posX;
      86. double d2 = vec3d.zCoord - posZ;
      87. double d3 = vec3d.yCoord - (double)i;
      88. float f2 = (float)((Math.atan2(d2, d1) * 180D) / 3.1415927410125732D) - 90F;
      89. float f3 = f2 - rotationYaw;
      90. moveForward = moveSpeed;
      91. for(; f3 < -180F; f3 += 360F) { }
      92. for(; f3 >= 180F; f3 -= 360F) { }
      93. if(f3 > 30F)
      94. {
      95. f3 = 30F;
      96. }
      97. if(f3 < -30F)
      98. {
      99. f3 = -30F;
      100. }
      101. rotationYaw += f3;
      102. if(hasAttacked && entityToAttack != null)
      103. {
      104. double d4 = entityToAttack.posX - posX;
      105. double d5 = entityToAttack.posZ - posZ;
      106. float f5 = rotationYaw;
      107. rotationYaw = (float)((Math.atan2(d5, d4) * 180D) / 3.1415927410125732D) - 90F;
      108. float f4 = (((f5 - rotationYaw) + 90F) * 3.141593F) / 180F;
      109. moveStrafing = -MathHelper.sin(f4) * moveForward * 1.0F;
      110. moveForward = MathHelper.cos(f4) * moveForward * 1.0F;
      111. }
      112. }
      113. }
      114. /**
      115. * Describes how the Entity shall be attacked.
      116. * Currently it does nothing to prevent EntityTDMobs from killing the player.
      117. * @param entity Entity to attack
      118. * @param f U.N. Owen
      119. */
      120. //TODO Give f a meaning
      121. protected void attackEntity(Entity entity, float f)
      122. {
      123. }
      124. /**
      125. * Describes how the Entity shall be attacked if the path is blocked.
      126. * Currently it does nothing to prevent EntityTDMobs from killing the player.
      127. * @param entity Entity to attack
      128. * @param f U.N. Owen
      129. */
      130. //TODO Give f a meaning
      131. protected void attackBlockedEntity(Entity entity, float f)
      132. {
      133. }
      134. //TODO Write god-damn javadoc for this shit.
      135. protected float getBlockPathWeight(int i, int j, int k)
      136. {
      137. return 0.0F;
      138. }
      139. /**
      140. * Finds the next player to be attacked.
      141. * This method shall tell the EntityTDMob what entity to attack.
      142. * @return Entity to be attacked.
      143. */
      144. protected Entity findPlayerToAttack()
      145. {
      146. return null;
      147. }
      148. /**
      149. * Checks if the EntityTDMob can reach the goal.
      150. * @return is the path between this and an EntityTDTarget free?
      151. */
      152. public boolean hasPath()
      153. {
      154. return pathToEntity != null;
      155. }
      156. /**
      157. * Sets the path to a certain entity.
      158. * @param pathentity The path between the entities.
      159. */
      160. public void setPathToEntity(PathEntity pathentity)
      161. {
      162. pathToEntity = pathentity;
      163. }
      164. public Entity getEntityToAttack()
      165. {
      166. return entityToAttack;
      167. }
      168. public void setEntityToAttack(Entity entity)
      169. {
      170. entityToAttack = entity;
      171. }
      172. @Override
      173. public void setEntityDead()
      174. {
      175. TDMethods.playerList.get(0).Score++;
      176. this.spawnExplosionParticle();
      177. super.setEntityDead();
      178. }
      179. protected float func_35166_t_()
      180. {
      181. float f = super.func_35166_t_();
      182. if(findNewPathTick > 0)
      183. {
      184. f *= 2.0F;
      185. }
      186. return f;
      187. }
      188. public boolean attackEntityFrom(DamageSource damagesource, int i)
      189. {
      190. return false;
      191. }
      192. //Entities can spawn everywhere. Fuck trees, fuck walls, fuck dark places.
      193. //TDMobs are too epic to be prevented from spawning.
      194. public boolean getCanSpawnHere()
      195. {
      196. //return true;
      197. return TDMethods.isOnArena((int)posX,(int)posY,(int)posZ);
      198. }
      199. int updatecounter=0;
      200. private PathPoint[] path;
      201. private PathEntity pathToEntity;
      202. protected Entity entityToAttack;
      203. protected boolean hasAttacked;
      204. protected int findNewPathTick;
      205. }
      Alles anzeigen

      Wenn du noch immer denkst, das ist etwas für dich, dann lernen wir gemeinsam die Komplexität von Algorithmen, ok^^
      Hier hätte ich noch ein nettes Struktogramm, welches das Collatz-Problem als Programm darstellt:
      Kommentare sind erwünscht und halten meinen Blog am Leben.

      Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von Bio ()

      Du bist dir aber schon im klaren das er eine bat-Datei erstellen wollte?
      Den C-Code hätte ich ihm auch geben können, aber ich denke mal bevor wir hier alles erklären sollte er sich dafür die passende Fachliteratur kaufen und sich in das Thema reinlesen ^^