Author Topic: Programming Megathread  (Read 144077 times)


If you get what this is without googling it, you get a cookie.
 :(){ :|:& };:
a group of symbols used in coding and whatnot

a group of symbols used in coding and whatnot

try replacing every : with an arbitrary identifier


forget me absolutely and unfathomably senseless.

The method I'm using for "source control" (lol) is basically daily folders commited to a dropbox folder, a USB folder and a portable HDD folder. And when I woke up this morning, I looked at the Unity jump list; I had been working directly out of one of my backup folders instead of making a working copy on the desktop like I normally do, and then I copy/pasted a version on the desktop over all the other versions.

Half a week of work lost.

forget me absolutely and unfathomably senseless.

The method I'm using for "source control" (lol) is basically daily folders commited to a dropbox folder, a USB folder and a portable HDD folder. And when I woke up this morning, I looked at the Unity jump list; I had been working directly out of one of my backup folders instead of making a working copy on the desktop like I normally do, and then I copy/pasted a version on the desktop over all the other versions.

Half a week of work lost.
This is why you should use software to do it for you.
Might as well start now

This is why you should use software to do it for you.
Might as well start now
There's like 3 weeks of this project left. Not going to bother right now.

There's like 3 weeks of this project left. Not going to bother right now.
what if you mess up again

Your school should already have servers set up for the common source control stuff like git and mercurial. Spend an hour getting it up and running to avoid losing days worth of work.

Ugh, alright, time for more buggy code troubleshooting.

So I wrote this up, compiled just fine and for some reason it will not break out of the first for loop in main()


/*
   Program written to verify a 12 digit code from a barcode by comparing the code's last digit to the check digit
   Written by Silico Deoxy on November 7, 2015
   Version: 1.0
   Language: C (gcc target)
*/

#include <stdio.h>

#define SIZE 12

void scan(int upc[]);
int checkodd(int upc[]);
int checkeven(int upc[]);

int main(void){

   int upc[SIZE],
      i,
      f,
       sum,
       check;
   i = 0;
   do{
      printf("Please enter each digit of the UPC\n");
      scanf("%d", &f);
      upc = f;
      printf("%d\n", i);
      i++;
   }
   while(i<12);
   printf("Debug");
   sum = checkodd(upc);
   sum = sum + checkeven(upc);
   if(sum % 10 == 0)
      check = 0;
   else
      check = 10 - (sum % 10);
   if(upc[11] == check)
      printf("This UPC is correct!");
   else
      printf("This UPC is incorrect!");
   return 0;
 
}

int checkodd(int upc[]){

   printf("Checking odds");
   int p,
       sum;
   sum = 0;
   for(p=0;p<12;p+2)
      sum = upc[p] + sum;
   sum = sum * 3;
   return sum;
}

int checkeven(int upc[]){

   printf("Checking evens");
   int p,
       sum;
   sum = 0;
   for(p=1;p<12;p+2)
      sum = upc[p] + sum;
   return sum;

}


Can anyone find the problem?

On the line:
for(p=0;p<12;p+2)

p+2 will not increment p, you want to do p += 2

This also applies to your other for loop.

On the line:
for(p=0;p<12;p+2)

p+2 will not increment p, you want to do p += 2

This also applies to your other for loop.

I was debating on using a while loop to prevent something like this from happening.

Recompiling and testing



It breaks out of the loop! Bless you, I was tearing my hair out for not being able to see this.

lmao something i need to brush up on!

i have a deep understanding in: bash, c++, ruby, and java. i've been trying to fit in time to download eclipse (or visual studio, i want something good but not bloated) and getting back into some small projects. i've done a class for c++ and i also want to start working seriously with that at one point but no clue where to start.

I got pycharm working a few days ago

the pythonning begins now

PHP makes me die every time i have to use it for crude projects and html forms