Sharpienero

Forum User
  • Content count

    71
  • Joined

  • Last visited

Everything posted by Sharpienero

  1. I don't know what the errors were. I assume they were something to do with atoi.. But I fixed that rather quickly. Thanks again for your help! Edit: Here is my final code (thanks to BraXi): #include <string.h> #include <stdio.h> #include <stdlib.h> int main() { char word[50]; puts("Please enter the date to convert:"); fgets(word, sizeof(word), stdin); toDate(word); } void toDate(char *line) { static const char *months[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; int date[3]; // day, month, year char tokens[3][32]; int i = 0, j = 0, x = 0; int token = 0; memset(&tokens, 0, sizeof(*tokens)); //initialize char arrays as they're most likely populated with trash for (i = 0; i != strlen(line)+1; i++) //we're iterating through the whole line char by char to find delimeters, either - or / { if( token >= 3 ) break; // we're out of dd/mm/yy char ch = line[i]; if (ch == '-' || ch == '/') // find delimeter { tokens[token][x] = NULL; token++; x = 0; continue; } if( x >= 32 ) continue; // make sure we don't cause segfault due to OOB [out of bounds] len tokens[token][x] = ch; x++; } for (i = 0; i != 3; i++) // go through the raw date[] { char *str = tokens[i]; date[i] = atoi(str); // convert string to integer if (i != 1) continue; //not a month so go back for (j = 0; j != 12; j++) // loop through 12 months to see if month was written with letters { if (strcasecmp(str, months[j]) == 0) //match { date[1] = j+1; break; } } if (date[1] > 12 || date[1] < 0) //make sure we've got correct month date[1] = 1; } printf("Input: %s", line); printf("Converted: %s %i, %i\n", months[date[1]-1], date[0], date[2]); } And output: http://i.imgur.com/XizZPo6.gifv
  2. This was my initial test. :okay: Thank you for your assistance. I'll try to work out the bugs.
  3. Or.. you could actually donate and really help the cause. #prayingdoesn'thelp https://soutenir.croix-rouge.fr/
  4. Welcome
  5. Welcome.
  6. Welcome to the server and the community. I hope you enjoy the people here and find yourself a new home.
  7. They've addressed that issue after we found the exploit it and removed it. Simple SQLi.
  8. In the big picture? It's not okay. In the miniscule fair usage for an individual "testing" the software? It's fine.
  9. A piece of code I worked on at a hackathon this weekend. It wasn't anything particularally intricate or impressive, but it felt like a milestone for me.
  10. Bottom line? Age is irrelevant when you're dealing with personality traits rather than physical attributes. Yes; as a general trend younger people tend to be less mature. But this is simply not true for all and shouldn't be held against someone in a place where it is truly irrelevant. Good for you, JayWubulvueahles.
  11. Try to set the game mode via rcon. I've actually got no idea, but this is my best uneducated guess.
  12. While on the topic, I'm not sure if anyone would agree with me here; but I think they should be a darker color? Maybe the default text color inside of the spoiler could be changed. this white kills my eyes Could try something like: { background: #2f2f2f; }
  13. yucky
  14. Congratulations on your promotion!
  15. Could be an issue with minification.
  16. addMenuOption("^3Menu Version","info",::click); //do not change!! heh
  17. Heh, legit versions. *cough* tpb *cough*
  18. I tell most people that there was a sharpie on the desk and I was listening to the band NERO. But honestly, I don't recall. Just popped into my head.
  19. Why not just go buy a new usb? They're cheap for a 2.0.
  20. Lightshot is great and all, but I recommend using ShareX. It's open source and light weight. Here is a download link to all of @'s wallpapers.
  21. Hi, I wrote this program and it works properly, but I'm looking for ways to make it somewhat more efficient and or improve readability. Here is the code on hastebin. #include <stdio.h> int main (void) { float a[2][2]; float constant[2]; float x[2]; double a2; double determinant; puts("Give 6 numbers seperated with a space (i.e 1 2 3 4 5 6): "); scanf("%f %f %f %f %f %f", &a[0][0], &a[0][1], &constant[0], &a[1][0], &a[1][1], &constant[1]); determinant = (a[0][0] * a[1][1]) - (a[0][1] * a[1][0]); if (determinant == 0) { puts("Too complicated!"); return 0; } a2 = a[0][0]; a[0][0] = ((a[1][1]) / (determinant)); a[1][1] = ((a2) / (determinant)); a[1][0] = ((-a[1][0]) / (determinant)); a[0][1] = ((-a[0][1]) / (determinant)); x[0] = (a[0][0] * constant[0]) + (a[0][1] * constant[1]); x[1] = (a[1][0] * constant[0]) + (a[1][1] * constant[1]); printf("x = %f\n" , x[0]); printf("y = %f\n" , x[1]); } I know that the parenthesis are majorly unneeded, but they help me logically see things. Feel free to show me a new way to stylize things.
  22. Ah, you're totally right! I didn't realize that I was multiplying mxn by pxn rather than mxn by nxp. The resulting output should be a mxp, so I can see why you said it's mathematically incorrect. Do you think that I should make it multiply correctly? I put that it was too complicated due to the fact that it's what the professor wanted us to write. I'm thinking back in my discrete mathematics class, and yes, I do recall the information regarding the inverse of the matrices. Is it also possible to do this with 2-two dimensional arrays? I was thinking of making an algorithm to multiply larger matrices (possibly 3x3?), but that's kind of hard for me to even fathom. Thank you for your input!