Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Manila, Philippines
    Posts
    64
    Rep Power
    5

    My C Exercises Thread


    Hi guys,

    This thread is where I will compile all my C exercises as I self-study various C programming books. I do hope to improve as I go along. The purpose of this thread is to keep track of my progress and get input from seasoned coders about how a particular program could be made better, if I am unknowingly practicing bad coding habits/style, or any other coding advice. Guidance from you folks would be very much appreciated.

    That is about it for now. Thank you!

    Currently Reading: Absolute Beginner's Guide to C, 2E (G. Perry)
    Compiler: Orwell Dev-C++ 5.4.2 RC6
    OS: Windows XP Pro SP3

    Program #1:
    Code:
    // The first C program
    
    #include <stdio.h>
    
    int main (void)
    {
    	printf ("Hello, world!\n");
    	
    	return 0;
    }
    Program #2:
    Code:
    // Program with good white space
    
    #include <stdio.h>
    
    int main (void)
    {
    	float s, t;
    		
    	printf ("How much money do you make? ");
    	scanf (" %f", &s);
    		
    	t = .33 * s;
    	printf ("You owe %.2f in taxes.", t);
    		
    	return 0;
    }
    Program #3:
    Code:
    // Program to illustrate character array
    
    #include <stdio.h>
    #include <string.h>
    
    int main (void)
    {
    	char name[10] = "Katherine"; // Define and initialize array
    	
    	// Initialize array one character at a time
    	name[0] = 'E';
    	name[1] = 'l';
    	name[2] = 'a';
    	name[3] = 'i';
    	name[4] = 'n';
    	name[5] = 'e';
    	name[6] = '\0'; // Null zero
    	
    	strcpy (name, "Eli"); // Puts new string in name array
    	
    	printf ("My love is %s.", name);
    	
    	return 0;
    }
    Program #4:
    Code:
    // Stores the days of the week in seven different character arrays
    
    #include <stdio.h>
    #include <string.h>
    
    int main (void)
    {
    	char day1[7] = "Sunday";
    	char day2[7] = "Monday";
    	char day3[8] = "Tuesday";
    	char day4[10] = "Wednesday";
    	char day5[] = "Thursday";
    	char day6[] = "Friday";
    	char day7[] = "Saturday";
    
    	char myName[6];
    	strcpy (myName, "Kathy");
    	
    	printf ("These are the 7 days of the week:\n"
    		"%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
    		day1, day2, day3, day4, day5, day6, day7);
    	
    	printf ("\nMy name is %s.", myName);
    	
    	return 0;
    }
    Program #5:
    Code:
    // Program to illustrate data-entry with scanf()
    
    #include <stdio.h>
    
    int main (void)
    {
    	int age, weight, month, day, year;
    	char first[15], middle[15], last[15];
    	
    	printf ("What is your first name? "); // A prompt
    	scanf (" %s", first); // No ampersand on character arrays
    	printf ("What is your middle name? ");
    	scanf (" %s", middle);
    	printf ("What is your last name? ");
    	scanf (" %s", last);
    	
    	printf ("When were you born (mm/dd/yy)? ");
    	scanf (" %i/%i/%i", &month, &day, &year); // scanf() expecting specific format
    	printf ("How old are you? ");
    	scanf (" %i", &age); // Ampersand required
    	
    	printf ("How much do you weigh (in lbs)? ");
    	scanf (" %i", &weight);
    	
    	printf ("\nHere is the information you entered:\n");
    	printf ("Name: %s %s %s\n", first, middle, last);
    	printf ("Birthdate: %i/%i/%i\n", month, day, year);
    	printf ("Age: %i\n", age);
    	printf ("Weight: %i lbs", weight);
    	
    	return 0;
    }
    Program #6:
    Code:
    // Computes net tire sales
    
    #include <stdio.h>
    
    int main (void)
    {
    	int numTires;
    	float tirePrice, beforeTax, netSale;
    	float taxRate = 0.07;
    	
    	printf ("How many tires were bought? ");
    	scanf (" %i", &numTires);
    	printf ("How much for each tire? ");
    	scanf (" %f", &tirePrice);
    	
    	beforeTax = numTires * tirePrice;
    	netSale = beforeTax + (beforeTax * taxRate);
    	
    	printf ("Your total sale is %.2f.", netSale);
    		
    	return 0;
    }
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Manila, Philippines
    Posts
    64
    Rep Power
    5
    Program #7:
    Code:
    // Program illustrating relational operators
    
    #include <stdio.h>
    
    int main (void)
    {
    	int a, b;
    	
    	a = (4 < 10);  // Truth value is 1
    	b = (8 == 10); // Truth value is 0 
    	
    	printf ("a + b = %i", a + b);
    	
    	return 0;
    }
    Program #8:
    Code:
    // More on relational operators
    
    #include <stdio.h>
    
    int main (void)
    {
    	int age, yrs;
    	
    	printf ("How old are you? ");
    	scanf (" %i", &age);
    	
    	if (age < 18)
    	{
    		printf ("\nYou cannot vote yet!\n");
    		yrs = 18 - age;
    		printf ("You can vote in %i years!", yrs);
    	}
    	else
    	{
    		printf ("\nYou are eligible to vote!\n");
    	}
    	
    	return 0;
    }
    Program #9:
    Code:
    // Program to compute simple tax ver. A
    
    #include <stdio.h>
    #define MAXSAL 18000.00
    
    int main (void)
    {
    	float salary, taxAmt;
    	float taxRate = 0.35;
    	
    	printf ("How much did you earn last year? ");
    	scanf (" %f", &salary);
    	
    	// Compute for tax amount
    	if (salary > MAXSAL)
    	{
    		taxAmt = salary * taxRate;
    	}
    	else
    	{
    		taxAmt = 0.0;
    	}
    	
    	printf ("Your tax is %.2f", taxAmt);
    	
    	return 0;
    }
    Program #10:
    Code:
    // Program to compute simple tax ver. B
    
    #include <stdio.h>
    #define MAXSAL 18000.00
    
    int main (void)
    {
    	float salary, taxAmt;
    	float taxRate = 0.35;
    	
    	printf ("How much did you earn last year? ");
    	scanf (" %f", &salary);
    	
    	// Compute for tax amount
    	if (salary > MAXSAL)
    	{
    		taxAmt = salary * taxRate;
    		printf ("Your tax is %.2f", taxAmt);
    	}
    	else
    	{
    		printf ("You are exempted fron tax!");
    	}
    	
    	return 0;
    }
    Program #11:
    Code:
    // Program to test unlike data types in relational statements
    
    #include <stdio.h>
    
    int main (void)
    {
    	int iVal;
    	float fVal;
    	
    	printf ("Enter integer value: ");
    	scanf (" %i", &iVal);
    	printf ("Enter float value: ");
    	scanf (" %f", &fVal);
    	
    	if (iVal > fVal)
    	{
    		printf ("The integer has greater value.");
    	}
    	else
    	{
    		printf ("The float has greater value.");
    	}
    	
    	return 0;
    }
    Program #12:
    Code:
    // Program to illustrate the && logical operator
    
    #include <stdio.h>
    
    int main (void)
    {
    	char lastName[25];
    	
    	printf ("What is your last name? ");
    	scanf (" %s", lastName);
    	
    	if ((lastName[0] >= 'P' && lastName[0] <= 'S') ||
    		(lastName[0] >= 'p' && lastName[0] <= 's'))
    	{
    		printf ("You must go to room 2432 for your tickets.");
    	}
    	else
    	{
    		printf ("You can get your tickets here.");
    	}
    	
    	return 0;
    }
    Program #13:
    Code:
    // Program to illustrate the || logical operator
    
    #include <stdio.h>
    
    int main (void)
    {
    	char ans;
    	
    	printf ("Is your printer on (Y/N)? ");
    	scanf (" %c", &ans);
    	
    	// Checks if input is Y/y or N/n
    	if ((ans == 'Y' || ans == 'y') || (ans == 'N' || ans == 'n'))
    	{
    		if (ans == 'Y' || ans == 'y')
    		{
    			printf ("Turn your printer OFF.");
    		}
    		else
    		{
    			printf ("Turn your printer ON.");
    		}
    	}
    	// Executes if input is neither Y/y or N/n
    	else
    	{
    		printf ("Your input is invalid!");
    	}
    	
    	return 0;
    }
    Program #14:
    Code:
    // Identify top-notch student
    
    #include <stdio.h>
    
    int main (void)
    {
    	float avg;
    	int hrs;
    	
    	printf ("What is your GWA last trimester? ");
    	scanf (" %f", &avg);
    	printf ("How many hours did you take? ");
    	scanf (" %i", &hrs);
    	
    	if (avg >= 90 && hrs >= 15)
    	{
    		printf ("You are a top-notcher!");
    	}
    	else
    	{
    		printf ("Try harder next time!");
    	}
    	
    	return 0;
    }
    Program #15:
    Code:
    // Identify top-notch student
    // Program to illustrate the ?: conditional operator
    
    #include <stdio.h>
    
    int main (void)
    {
    	float avg;
    	int hrs;
    	
    	printf ("What is your GWA last trimester? ");
    	scanf (" %f", &avg);
    	printf ("How many hours did you take? ");
    	scanf (" %i", &hrs);
    	
    	(avg >= 90 && hrs >= 15) ? printf ("You are a top-notcher!") :
    		printf ("Try harder next time!");
    	
    	return 0;
    }
    Program #16:
    Code:
    // More on conditional operators
    
    #include <stdio.h>
    
    int main (void)
    {
    	int numPear;
    	
    	printf ("How many pears have you eaten? ");
    	scanf (" %i", &numPear);
    	
    	printf ("You ate %i pear%s", numPear, (numPear > 1) ? ("s.") : ("."));
    	
    	return 0;
    }
  4. #3
  5. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481

    Programs 1--6 comments


    When my notes bore you skip to problem 5. Crisis!


    Program 1: use puts("hi world"); instead of printf.
    printf wastes time parsing the format string which has no formatting characters.

    Program 2:
    Code:
    #include <stdio.h>
    
    int main (void) {
      float s, t;
    		
      fputs ("How much money do you make? ",stdout);  /* same as program 1.  Don't use printf if you don't need it. */
    
      if (1 != scanf (" %f", &s)) {  /* The input might have been bad.  Check the scanf return status. */
        s = 1;
        printf("Bad input.  Let's pretend your income was %.2f\n", s);
      }
      t = .33 * s;
      printf ("You owe %.2f in taxes.", t);
    		
      return 0;
    }
    Program 3: Where "Eli" appears substitute "Dave".

    Program 4: This is the best program I've ever seen.

    Program 5: Your scanf enables buffer overrun attacks. Either use fgets to get a string, or specify the field width.
    Code:
    // Program to illustrate data-entry with scanf()
    // This version survives a first name entry of
    // uaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    
    #include <stdio.h>
    #include <stdlib.h>
    
    void prompt_string(char*prompt, char*s, int n) {
      /* standard functions are at such low level they should often be wrapped in your higher level code */
      char format[32];		/* use plenty of space */
      sprintf(format," %%%ds", n-1); /* reserve space for nul byte of ASCIIz string */
      puts(prompt);
      scanf(format, s);		/* ignorable return code?  Less likely to fail that conversions to numbers. */
    }
    
    int main (void) {
      char first[15] = "dwl";
      prompt_string("What is your first name? ", first, 15);
      printf("Hi %s\n", first);
      return 0;
    }
    program 6: Minor changes make your code survive input like aaa bbb ccc deuuuuuuuuuuu uuuuuuuuuuuuuu
    I hope you're figuring out that if at the start you had written a prompt for floats/int function that overall you'd have better code and less of it.
    Code:
    // Computes net tire sales
    
    #include <stdio.h>
    
    int main (void)
    {
    	int numTires = 0;	/* set default values */
    	float tirePrice = 0,
    	float beforeTax, netSale;
    	float taxRate = 0.07;
    	
    	fputs ("How many tires were bought? ", stdout);
    	scanf (" %i", &numTires);
    	fputs ("How much for each tire? ", stdout);
    	scanf (" %f", &tirePrice);
    	
    	beforeTax = numTires * tirePrice;
    	netSale = beforeTax + (beforeTax * taxRate);
    	
    	printf ("%s%.2f.", "Your total sale is ", netSale); /* probably more efficient but unreadable */
    		
    	return 0;
    }

    Comments on this post

    • kathyrollo agrees : Thank you very much, though I don't think I have enough rep power.
    [code]Code tags[/code] are essential for python code and Makefiles!
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481

    Comments, 7--16


    Program 7: Parenthesized relational operations. Great! I like parentheses around all subexpressions that don't have familiar algebraic precedence. Unless the language is much simpler j, in which noun-verb sequences evaluate from right to left without precedence.


    Program #8: please rewrite at least one of these programs using fputs and testing the result of scanf. Programs need to give reasonable results when presented with bad input. Quitting with a message is the lowest common denominator "reasonable" behavior. Calling printf in multiple places is a bad idea, but so is an unreadable program. Consider rewriting
    Code:
    	{
    		printf ("\nYou cannot vote yet!\n");
    		yrs = 18 - age;
    		printf ("You can vote in %i years!", yrs);
    	}
    as
    Code:
    	{
    		yrs = 18 - age;
    		printf ("\nYou cannot vote yet!\n"
                            "You can vote in %i years!\n", yrs);
    	}

    Program #9: Your earlier experiment with Booleans showed they have a computational value of 0 or 1. I'd reduce the number of paths through your program by replacing
    Code:
    	if (salary > MAXSAL)
    	{
    		taxAmt = salary * taxRate;
    	}
    	else
    	{
    		taxAmt = 0.0;
    	}
    with
    Code:
    taxAmt = (salary * taxRate) * (salary > MAXSAL);

    Program #10: no comment


    Program #11:
    printf("The %s has greater value.", (iVal > fval) ? "integer" : "float");


    Program #12: Be assured I'd write the code differently.
    Program #13:
    Program #14:


    Program #15: NO. NO. NO. NO
    Code:
    puts(((avg >= 90) && (hrs >= 15)) ?
     "You are a top-notcher!" : "Try harder next time!");

    Program #16:
    /* I moved the . saving one character. */
    printf ("You ate %i pear%s.", numPear, (numPear > 1) ? ("s") : (""));
    [code]Code tags[/code] are essential for python code and Makefiles!
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Manila, Philippines
    Posts
    64
    Rep Power
    5
    First, hats off to you, good sir. :cheers:
    I didn't really expect anyone to digest every code, so thank you very much for that.

    #1: Useful info on puts(). Well noted.
    #8: I'll definitely keep my printf()'s in check.
    #11: Indeed, I was just about to learn the ?: operator in the subsequent programs.
    #15: I felt that one was way off haha. First experiment with the ?: operator.
    #16: I see. Would char be more preferable like this?
    Code:
    printf ("You ate %i pear%c.", numPear, (numPear > 1) ? ('s') : (''));
    I will figure out the rest later. Again, thanks a lot for your help.

    Oh and...
    Program 3: Where "Eli" appears substitute "Dave".
    UNEXPECTED ERROR :D
  10. #6
  11. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    #16: I see. Would char be more preferable like this?
    Code:
    printf ("You ate %i pear%c.", numPear, (numPear > 1) ? ('s') : (''));

    Not ok. '' isn't character. Hey, you've got a compiler.
    [code]Code tags[/code] are essential for python code and Makefiles!
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Manila, Philippines
    Posts
    64
    Rep Power
    5
    Yep, was about to scratch that. Sorry, was speed replying haha. Thanks.

    [E D I T]

    Program #17:
    Code:
    // Program to illustrate sizeof() operator
    
    #include <stdio.h>
    
    int main (void)
    {
    	char name[] = "Katherine Rollo";
    	int i = 30;
    	
    	printf ("The size of i is %i\n"
    		"The size of name is %i", sizeof(i), sizeof(name));
    	
    	return 0;
    }
    Program #18:
    Code:
    // Works with an age and an integer
    // Testing conditional, increment, decrement, and sizeof() operators
    
    #include <stdio.h>
    
    int main (void)
    {
    	int age, intSize;
    	float gift;
    	char name[25];
    	
    	fputs ("What is your name? ", stdout);
    	scanf (" %s", name);
    	fputs ("How old are you? ", stdout);
    	scanf (" %i", &age);
    	
    	printf ("\nHello, %s!\n", name);
    	printf ("Your gift is $%.2f\n", gift, gift = (age < 18) ? 5.00 : 10.00);
    	printf ("You were %i years old last year.\n"
    		"Next year, you will be %i years old.\n", --age - 1, ++age);
    	printf ("\nName is preset to %i memory locations.\n"
    		"Integers take %i memory locations.", sizeof(name), sizeof(intSize));
    			
    	return 0;
    }
  14. #8
  15. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Manila, Philippines
    Posts
    64
    Rep Power
    5
    Program #19:
    Code:
    // Using while loop
    
    #include <stdio.h>
    
    int main (void)
    {
    	int amount;
    	
    	printf ("What is the amount? ");
    	scanf (" %i", &amount);
    	
    	while (amount < 25)
    	{
    		printf ("Amount is too small.\n"
    			"What is the new amount? ");
    		scanf (" %i", &amount);
    	}
    	
    	printf ("You have entered the right amount!");
    	
    	return 0;
    }
    Program #20:
    Code:
    // Prints 1 to 20 twice
    
    #include <stdio.h>
    
    int main (void)
    {
    
    	// Print using while loop
    	int ctr = 1;
    	while (ctr <= 20)
    	{
    		printf ("%i\n", ctr);
    		ctr++;
    	}
    
    	// Print using do-while loop
    	ctr = 1;
    	do
    	{
    		printf ("%i\n", ctr);
    		ctr++;
    	}
    	while (ctr <= 20);
    
    	return 0;
    }
    Program #21:
    Code:
    // For loop
    
    #include <stdio.h>
    
    int main (void)
    {
    	int ctr;
    	
    	for (ctr = 1; ctr <= 10; ctr++)
    	{
    		printf ("Still counting... %i\n", ctr);
    	}
    	
    	return 0;
    }
  16. #9
  17. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481

    Time for another opinion!


    #18 is critical.


    #17, I believe the format specifier should be %u

    printf ("The size of i is %i\n"
    "The size of name is %i", sizeof(i), sizeof(name));



    #18,
    scanf (" %s", name); //// Avoid buffer overrun! Specify the field width.
    scanf (" %i", &age); /////// check the return value of scanf. The input wasn't necessarily a number.




    #19 is not okay at all. If there is no input your program runs forever,
    hopelessly ensuring the uniform temperature heat death of the universe.
    Let's call the program c .
    c < /dev/null



    #20 You've outdone yourself. Once again, as good a program I've ever seen.




    #21 is a poorly chosen exercise, not your fault. for loops are often used to
    advance an array index. Since array indexes start with 0, the typical pattern is
    for (i = 0; i < n; ++i) {
    array[i] = f(x[i]);
    }
    My complaint is starting from 1 and using <= .





    Time for another opinion. Would you want Kathyrollo to be b49p23tivg'ized?
    [code]Code tags[/code] are essential for python code and Makefiles!
  18. #10
  19. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Manila, Philippines
    Posts
    64
    Rep Power
    5
    Program #22:
    Code:
    // For loop countdown
    // Initial value must be greater than test value for decrement
    
    #include <stdio.h>
    
    int main (void)
    {
    	int ctr;
    	
    	for (ctr = 10; ctr > 0; ctr--)
    	{
    		printf ("%i\n", ctr);
    	}
    	printf ("Blast off!");
    	
    	return 0;
    }
    Program #23:
    Code:
    // Nested for loops
    
    #include <stdio.h>
    
    int main (void)
    {
    	int a, b;
    	
    	for (a = 0; a < 3; a++)
    	{
    		// This will be repeated 3 times
    		for (b = 1; b <= 5; b++)
    		{
    			// This will be repeated 5 times
    			printf ("%i ", b);
    		}
    		printf ("\n");
    	}
    	
    	return 0;
    }
    Program #24:
    Code:
    // Print 1 to 20 twice using for loop on while
    
    #include <stdio.h>
    
    int main (void)
    {
    	int a, b;
    	
    	for (a = 0; a < 2; a++)
    	{
    		b = 1;
    		while (b < 21)
    		{
    			printf ("%i\n", b);
    			b++;
    		}
    	}
    
    	return 0;
    }
    Program #25:
    Code:
    // Print 1 to 20 twice using for loop on do-while
    
    #include <stdio.h>
    
    int main (void)
    {
    	int a, b;
    	
    	for (a = 0; a < 2; a++)
    	{
    		b = 1;
    		do
    		{
    			printf ("%i\n", b++);
    		}
    		while (b < 21);
    	}
    	
    	return 0;
    }
  20. #11
  21. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,117
    Rep Power
    1803
    Originally Posted by kathyrollo
    This thread is where I will compile all my C exercises as I self-study various C programming books.
    No, please don't! I can't think of a worse idea.

    Just post questions on individual issues you need help with - on separate threads. That's how this forum works best. The thread has already become unwieldy before anyone else has even posted to it; it will quickly get to the point where no one will even bother reading it, or it will become a Tower of Babel, with contributors discussing different pieces of code and different issues and struggling or failing or not even bothering to make it clear to what or who they are referring.

    Short and to the point gets best results.
  22. #12
  23. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,117
    Rep Power
    1803
    Originally Posted by kathyrollo
    I didn't really expect anyone to digest every code
    Me neither ;) . You got lucky on the generosity of others (or at least that of b49P23TIvg). Maybe I am just too cynical. I stand my assertion that this thread will tend toward entropy however. I can't see how that amount of effort can be maintained, or any clarity by the time you have posted you #50 code fragment.
  24. #13
  25. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,995
    Rep Power
    481
    In place of printf ("\n"); use putchar('\n');



    Finally, let's time program 24 written in two ways. c2 is (I'm an engineer) 40 times faster than program c .
    Code:
    $ time ./c2 > /dev/null
    
    real	0m0.459s
    user	0m0.424s
    sys	0m0.036s
    $ time ./c > /dev/null
    
    real	0m22.514s
    user	0m22.397s
    sys	0m0.068s
    $
    Instead of twice, we'll repeat printing 1 through 20 ten million times. Set N to 2 and show the results on stdout if you need to verify the resulting output is the same.

    Code:
    /* c2.c precomputes the value to be printed. */
    
    // Print 1 to 20 N times
    
    #include <stdio.h>
    #define N 10000000
    
    int main (void) {
      int
        a;
      char
        buffer[1024 /* 20*3==60 */],
        *pc = buffer; 
    
      for (a = 0; a++ < 20; ) {
        sprintf(pc,"%i\n", a);
        while (*pc)
          ++pc;
      }
    
      for (a = 0; a < N; ++a)
        fputs(buffer, stdout);
    
      return 0;
    }

    And the source for c.c compiled to ./c :
    Code:
    // Print 1 to 20 N times
    
    #include <stdio.h>
    #define N 10000000
    
    int main (void)
    {
    	int a, b;
    	
    	for (a = 0; a < N; a++)
    	{
    		b = 1;
    		while (b < 21)
    		{
    			printf ("%i\n", b);
    			b++;
    		}
    	}
    
    	return 0;
    }
    [code]Code tags[/code] are essential for python code and Makefiles!
  26. #14
  27. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Manila, Philippines
    Posts
    64
    Rep Power
    5
    @clifford:
    As mentioned, I didn't really expect anyone to respond to every code. I don't have particular questions for the codes here, so I've compiled them in a thread. If there's something I couldn't really get to work, I'll be sure to dedicate a thread for it.

    This is more or less a self-reference, something to look back to as I progress, but input from experienced coders are always appreciated. :)
  28. #15
  29. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,117
    Rep Power
    1803
    Originally Posted by kathyrollo
    This is more or less a self-reference, something to look back to as I progress, but input from experienced coders are always appreciated. :)
    Perhaps http://codepad.org/ might be a more appropriate place for that? Not to discourage you at all, but I am not certain that this approach will be as effective as you might wish - I think you got lucky in your response so far.
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo