All pastes #1491815 Raw Edit

Untitled

public text v1 · immutable
#1491815 ·published 2009-07-11 15:03 UTC
rendered paste body
pastebin - Unnamed - post number 1491801Part of Slepp's Projects %u2014 Pastebin %u2014 TURL %u2014 Imagebin %u2014 FilebinFeedback -- English French German JapaneseHide Menu -- Switch StylesheetsCreate Upload Newest Tools DonateBarnsk | Your Pastes | Settings | LogoutStuff to DoNew PostUpload a PostGoto NewestSearchArchivesTools / APIsDonatePaste ActionsDownload RawEmbedpBox URLPost to TwitterBookmark/ShareView TreeRemove PasteInformationSite NewsGet a PastebinWhat is This?Bugs?StatisticsPaste DetailsC Source format, 24 minutes 16 seconds old, and 9 hits.Quick SearchRecent PostsSomething28 secsMiscellany2 mins 20 secsMiscellany3 mins 23 secsamature7 mins 22 secsMiscellany9 mins 48 secsActinnamits10 mins 30 secsAction ScriptMiscellany10 mins 39 secsHTML 4.0 StrictUntitled14 mins 52 secsMiscellany20 mins 33 secsMiscellany24 mins 2 secs#gem rules24 mins 6 secsUnnamed24 mins 16 secsC SourceAnonymous24 mins 30 secsUnnamed25 mins 9 secsUnnamed25 mins 28 secsUnnamed    Saturday, July 11th, 2009 at 8:36:26am MDT Font: Small - Normal - Large   1.      /*#include <stdlib.h>   2.      #include <netinet/in.h>   3.      #include <sys/socket.h>   4.      */   5.      #include <stdio.h>   6.      /*   7.      int a[5];   8.      int i;   9.      */  10.      char functname[20];  11.      int playcount = 0;  12.      // int play;  13.         14.      void comparator(); // This is the prototype definition of the function for ANSI C. They  15.      void listnumbers(); // This is the prototype defintion of the function for ANSI C  16.      void infinteloop();  17.      void printnumbers();  18.      void printstring();  19.      void swap(int *, int *);  20.      char getplay();  21.         22.      main() {  23.              while(1) {  24.                              char play;  25.      /*                  play = getplay();  26.                              while(play == 'y') {  27.                                      int a;  28.                                      printf("DID WE GET HERE? INFINTELOOP()???");  29.                                      scanf("%d" , &a); // INFINTE LOOP EXAMPLE  30.                              if(a==10) {  31.                                      printf("end of infinte loop");  32.         33.              }  34.         35.                              }  36.      */  37.         38.                      int i;  39.                      printf("\n***********************");  40.                      printf("\n*****INPUT CHOICE******");  41.                      printf("\n***********************");  42.                      printf("\n**  1. listnumbers() **");  43.                      printf("\n**  2. comparator()  **");  44.                      printf("\n**  3. infinteloop() **");  45.                      printf("\n**  4. printnumbers()**");  46.                      printf("\n**  5. printstring() **");  47.                      printf("\n***********************");  48.                      printf("\n***********************");  49.                      printf("\nInput 1-5: ");  50.                      scanf("%d", &i);  51.                      switch (i) {  52.                              case 1:  53.                              listnumbers();  54.                              break;  55.                              case 2:  56.                              comparator();  57.                              break;  58.                              case 3:  59.                              strcpy(functname, "infinteloop");  60.                              play = getplay();  61.                              while(play == 'y') {  62.                                      infinteloop();  63.                              }  64.                              break;  65.                              case 4:  66.                              printnumbers();  67.                              break;  68.                              case 5:  69.                              printstring();  70.                              break;  71.                              default:  72.                              printf("Invalid input");  73.                              break;  74.                      }  75.                      // swap(1,2);  76.      /*      int r = rand() % 100; // RANDON NUMBER EXAMPLE - If you look at the last two digits of all of these numbers they would form our random set! To select just these numbers we can use an arithmetic calculation of the following form: That is, to get the number into the right range you simply take the remainder on dividing by 100, ie a value in the range 0 to 99.  77.              printf("\nOk, time to guess %d... ", r);  78.              scanf("%d" , &a);  79.              while(a != r) {  80.                      printf("\nTry again...");  81.                      if (a < r) {  82.                              printf("Too low.\n");  83.                      }  84.                      else {  85.                              printf("Too high.\n");  86.                      }  87.                      scanf("%d" , &a);  88.              }  89.              if(a == r) {  90.                      printf("\nCorrect! Look at the big brain on Bret!\n");  91.              } */  92.      }  93.      return 0;  94.      }  95.         96.      void swap(int *a, int *b) {  97.                      int temp;  98.                      temp = *a; // temp is equal to the value of point a (whatever the first incoming param is)  99.                      *a = *b; // *a is equal to the value of pointer b (whatever the second incoming param is) 100.                      *b = temp; // now *b is equal to the value of temp (which was a) 101.              //      printf("%d" , a , b); 102.      } 103.      void printstring() { 104.              char a[40]; 105.      //      strcpy(a, "hello"); 106.              107.              //printf("OK lets have it, 40 characters max: "); 108.              //scanf("%s", a); 109.              printf("Thanks, here it is...\n\n"); 110.              printf("%s", a); 111.              printf("\n\n"); 112.              113.      } 114.      void infinteloop() { // under construction to fix overall control styles 115.              int a; 116.              printf("\nWe made it to infinteloop()\n"); 117.              scanf("%d" , &a); // INFINTE LOOP EXAMPLE 118.              while(a==10) { 119.                      printf("\nEnd of infinte loop...\n"); 120.                      break; 121.              } 122.              printf("\n We made it to return in infinteloop()..\n"); 123.      } 124.        125.      char getplay() { 126.              int play; 127.              printf("Play %s y/n ?" , functname); 128.              play = -1; 129.              while (play == -1) { 130.            play=getchar(); 131.              } 132.              return play; 133.      } 134.        135.      void comparator(int play, int a, int b) { 136.              printf("\nHello this is comparator()"); 137.              printf("\nDo you want to play? Y=1 N=0: "); 138.              scanf("%d" , &play); 139.              while(play) { 140.                      printf("\nEnter first number: "); 141.                      scanf("%d" , &a); // %d represents the data type for numbers 142.                      printf("\nEnter second number: "); 143.                      scanf("%d" , &b); 144.              145.                      if(a>b) { 146.                              printf("\nFirst number greater than second"); 147.                              printf("\nDifference is: %d\n\n", a-b); 148.                      } 149.                      else if(a<b) { 150.                              printf("\nSecond number greater than first"); 151.                              printf("\nDifference is: %d\n\n", b-a); 152.                      } 153.                      else { 154.                              printf("\n\nHey whats going on here buddy? Its equal. Ill cut you.\n\n"); 155.                      } 156.                      return; 157.              } 158.      } 159.      void listnumbers(int play, int i, int a[5]) { 160.              printf("\nHello this is listnumbers()"); 161.              printf("\nDo you want to play? Y=1 N=0: "); 162.              scanf("%d" , &play); 163.              while(play) { 164.                      for(i = 0; i < 5; i  ) { // FOR LOOP EXAMPLE 165.                              printf("Input %d:",i); 166.                              scanf("%d",&a[i]); 167.                      } 168.                      if(i == 5) { 169.                              printf("Thanks for the input, dick.\n"); 170.                      } 171.                      printf("Numbers were:"); 172.                      for(i = 0; i < 5; i  ){ 173.                              printf("%d,",a[i]); 174.                      } 175.                      printf("\n"); 176.                      return; 177.              } 178.      } 179.      void printnumbers(int play, int a) { 180.              printf("\nHello this is printnumbers()"); 181.              printf("\nDo you want to play? Y=1 N=0: "); 182.              scanf("%d" , &play); 183.              while(play) { 184.                      printf("\nInput a number 1-3 and press return: "); 185.                      scanf("%d" , &a); 186.                      switch(a) { 187.                              case 1: 188.                                      printf("one\n"); 189.                                      break; 190.                              case 2: 191.                                      printf("two\n"); 192.                                      break; 193.                              case 3: 194.                                      printf("three\n"); 195.                                      break; 196.                              default: 197.                                      printf("\n\n###Unrecognized number###\n\n"); 198.                      } 199.                      break; 200.              } 201.      }advertisingUpdate the PostEither update this post and resubmit it with changes, or make a new post.You may also comment on this post.update paste below/*#include <stdlib.h> #include <netinet/in.h> #include <sys/socket.h> */ #include <stdio.h> /* int a[5]; int i; */ char functname[20]; int playcount = 0; // int play; void comparator(); // This is the prototype definition of the function for ANSI C. They void listnumbers(); // This is the prototype defintion of the function for ANSI C void infinteloop(); void printnumbers(); void printstring(); void swap(int *, int *); char getplay(); main() { while(1) { char play; /* play = getplay(); while(play == 'y') { int a; printf("DID WE GET HERE? INFINTELOOP()???"); scanf("%d" , &a); // INFINTE LOOP EXAMPLE if(a==10) { printf("end of infinte loop"); } } */ int i; printf("\n***********************"); printf("\n*****INPUT CHOICE******"); printf("\n***********************"); printf("\n** 1. listnumbers() **"); printf("\n** 2. comparator() **"); printf("\n** 3. infinteloop() **"); printf("\n** 4. printnumbers()**"); printf("\n** 5. printstring() **"); printf("\n***********************"); printf("\n***********************"); printf("\nInput 1-5: "); scanf("%d", &i); switch (i) { case 1: listnumbers(); break; case 2: comparator(); break; case 3: strcpy(functname, "infinteloop"); play = getplay(); while(play == 'y') { infinteloop(); } break; case 4: printnumbers(); break; case 5: printstring(); break; default: printf("Invalid input"); break; } // swap(1,2); /* int r = rand() % 100; // RANDON NUMBER EXAMPLE - If you look at the last two digits of all of these numbers they would form our random set! To select just these numbers we can use an arithmetic calculation of the following form: That is, to get the number into the right range you simply take the remainder on dividing by 100, ie a value in the range 0 to 99. printf("\nOk, time to guess %d... ", r); scanf("%d" , &a); while(a != r) { printf("\nTry again..."); if (a < r) { printf("Too low.\n"); } else { printf("Too high.\n"); } scanf("%d" , &a); } if(a == r) { printf("\nCorrect! Look at the big brain on Bret!\n"); } */ } return 0; } void swap(int *a, int *b) { int temp; temp = *a; // temp is equal to the value of point a (whatever the first incoming param is) *a = *b; // *a is equal to the value of pointer b (whatever the second incoming param is) *b = temp; // now *b is equal to the value of temp (which was a) // printf("%d" , a , b); } void printstring() { char a[40]; // strcpy(a, "hello"); //printf("OK lets have it, 40 characters max: "); //scanf("%s", a); printf("Thanks, here it is...\n\n"); printf("%s", a); printf("\n\n"); } void infinteloop() { // under construction to fix overall control styles int a; printf("\nWe made it to infinteloop()\n"); scanf("%d" , &a); // INFINTE LOOP EXAMPLE while(a==10) { printf("\nEnd of infinte loop...\n"); break; } printf("\n We made it to return in infinteloop()..\n"); } char getplay() { int play; printf("Play %s y/n ?" , functname); play = -1; while (play == -1) { play=getchar(); } return play; } void comparator(int play, int a, int b) { printf("\nHello this is comparator()"); printf("\nDo you want to play? Y=1 N=0: "); scanf("%d" , &play); while(play) { printf("\nEnter first number: "); scanf("%d" , &a); // %d represents the data type for numbers printf("\nEnter second number: "); scanf("%d" , &b); if(a>b) { printf("\nFirst number greater than second"); printf("\nDifference is: %d\n\n", a-b); } else if(a<b) { printf("\nSecond number greater than first"); printf("\nDifference is: %d\n\n", b-a); } else { printf("\n\nHey whats going on here buddy? Its equal. Ill cut you.\n\n"); } return; } } void listnumbers(int play, int i, int a[5]) { printf("\nHello this is listnumbers()"); printf("\nDo you want to play? Y=1 N=0: "); scanf("%d" , &play); while(play) { for(i = 0; i < 5; i  ) { // FOR LOOP EXAMPLE printf("Input %d:",i); scanf("%d",&a[i]); } if(i == 5) { printf("Thanks for the input, dick.\n"); } printf("Numbers were:"); for(i = 0; i < 5; i  ){ printf("%d,",a[i]); } printf("\n"); return; } } void printnumbers(int play, int a) { printf("\nHello this is printnumbers()"); printf("\nDo you want to play? Y=1 N=0: "); scanf("%d" , &play); while(play) { printf("\nInput a number 1-3 and press return: "); scanf("%d" , &a); switch(a) { case 1: printf("one\n"); break; case 2: printf("two\n"); break; case 3: printf("three\n"); break; default: printf("\n\n###Unrecognized number###\n\n"); } break; } }details of the post (optional)Note: Only the paste content is required, though the following information can be useful to others.Name / Title: Save name / title?Description / Question:Tags: (space separated, optional)Content Type:Expire this post in:Encrypt this paste. Password:Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.worth-rightfantasy-obligationW3CXHTMLW3CCSSservices provided and written by Stephen Olesen - all layout and non-paste text copyright © 2003-2009 - myctoFeedback for Pastebin.cacloseCancel»Bookmark & SharePastebin / pBoxXSelect from these web-based feed readers:AOLBloglinesGoogle ReaderMy MSNNetvibesNewsGatorNewsisfreePageflakesTechnoratiYahooAIMAmazon WishlistAskBackflipBallHypeBeboBloggerBlogmarksBuzzDeliciousDiggDiigoEmailFacebookFarkFavesFavoritesFriendFeedGoogleHatenaKaboodlekIRTSYLink-a-GogoLinkedInLiveMenéameMister WongMixxMultiplymyAOLMySpaceNetvibesNetvouzNewsvineNujijPlaxoPrintPropellerRedditSegnaloSimpySlashdotSpurlStumbleUponStylehiveTechnoratiThisNextTip'dTumblrTwitterTypePadWordPressY! BookmarksYardbarkerDoneMessage sent! Share again.AddThis for FirefoxNEWBookmark, email or share any page, anytime.InstallUse Address BookTo: (email address)From: (email address)Note: (optional)255 character limitWhat's this?PrivacyAddThisBookmark & SharePastebin / pBoxEmailFavoritesPrintDeliciousDiggGoogleMySpaceLiveFacebookStumbleUponTwitterMore... (55)What's this?AddThis