Jump to content
xisto Community

methane

Members
  • Content Count

    6
  • Joined

  • Last visited

  1. Actually, javascript can do you need. You should write a function called by on submit form. In the javascript function you can use switch cases to check the inputs and then redirect the page to what you need it to go.
  2. What you said is correct, there is an additional character receive from fget. That is the newline character. Do you remember what is the last key when you input the command? That is the 'Enter' Key. So you have to include the newline character in your compare string. i.e. the compare string should be 'bob the builder\n' instead of 'bob the builder' char array[20]; printf("Enter a string\n\n"); fgets(array,1024,stdin); if(strcmp(array,"bob the builder\n")==0) { printf("%s is a valid command",array); } else { printf("Error: Unknown Command, try again"); } Actually, this problem can be solved if you run it in debug mode. Try to watch the variable and compare the strings manaully, you will found that 2 strings are somehow different.Please also be noted that your array size is only 20 while fgets read in 1024 bytes, it may cause memory error if you input string is longer than 19.
  3. For me I have got,1 x 16 MB SD2 x 256 MB SD1 x 512 MB Mini-SD1 x 1 GB SD1 X 128 MB MS1 X 64 MB Flash thumb Drive1 X 256 MP3 Player
  4. methane

    Google Earth

    Besides Google Earth, there is another site Google Moon https://www.google.com/moon/ Let's see when we will have google Solar System
  5. To find out the GCD/GCF of two integers, you can make use of euclidean algorithm. That is, GCD(a, = GCD(a%b, if a>b. You can use a recursive function to find out the answer in fewer steps. The function should look like this int GCD(int a , int { if (a == { return a; } if (a * b == 0) { return a + b; } return ( a%b , b%a); } Hope it can help. To find out the GCD/GCF of two integers, you can make use of euclidean algorithm. That is, GCD(a,b ) = GCD(a%b,b ) if a>b. You can use a recursive function to find out the answer in fewer steps. The function should look like this int GCD(int a , int b){ if (a == b) { return a; } if (a * b == 0) { return a + b; } return ( a%b , b%a);} Hope it can help.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.