Share your current writing

 
Verbatim
| Komm, süßer Tod
 
more |
XBL:
PSN: Verbatim-1
Steam: Jaco230
ID: Verbatim
IP: Logged

48,049 posts
not yet


Epsira | Legendary Invincible!
 
more |
XBL:
PSN:
Steam: interiminitiator
ID: Epsira
IP: Logged

4,019 posts
 
just wrote my midterm for data structures fam

Code: [Select]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

int main(int argc, char * argv[]) {
char op, my_string[5];
float num, num1, num2, fans;
int len, i = 0;

if (argc == 4) {
sscanf(argv[1], "%f", &num1);
sscanf(argv[2], "%c", &op);
sscanf(argv[3], "%f", &num2);

switch (op) {
case '+': fans = num1 + num2;
printf("%4.2f + %4.2f = %4.2f\n", num1, num2, fans);
break;

case '-': fans = num1 - num2;
printf("%4.2f - %4.2f = %4.2f\n", num1, num2, fans);
break;

case 'x':
case 'X': fans = num1 * num2;
printf("%4.2f x %4.2f = %4.2f\n", num1, num2, fans);
break;
case '/': if (num2 == 0) {
printf("Error: Cannot divide by zero.\n");
  }
          else {
fans = num1/num2;
printf("%4.2f / %4.2f = %4.2f\n", num1, num2, fans);
  }
break;

case '^': if (num1 == 0 && num2 <= 0) {
        printf("num1 ^ num2 can't be represented\n");
printf("%4.2f ^ %4.2f = %4.2f\n", num1, num2, fans);
  }
  else {
fans = pow(num1, num2);
  }
break;

default: printf("%c is not a valid selection\n", op);
break;
}
}
else if (argc == 3) {
sscanf(argv[1], "%c", &op);
sscanf(argv[2], "%f", &num);

switch (op) {
case 'n':
case 'N': fans = num * -1;
printf("-(%4.2f) = %4.2f\n", num, fans);
break;

case 'a':
case 'A': fans = fabs(num);
printf("|%4.2f| = %4.2f\n", num, fans);
break;

case 's':
case 'S': if (num < 0) {
printf("Error: Can't find square root of negative number.\n");
  }
  else {
fans = sqrt(num);
printf("Sqrt(%4.2f) = %4.2f\n", num, fans);
  }
break;

default: printf("%c is not a valid selection\n", op);
break;
}
}

else {
printf("Proper input: \n\tnumber operator number\n\t operator number\nEnter your expression: ");
gets(my_string);
len = strlen(my_string);
 
if (len == 5) {
sscanf(my_string, "%f %c %f", &num1, &op, &num2);

switch (op) {
case '+': fans = num1 + num2;
printf("%4.2f + %4.2f = %4.2f\n", num1, num2, fans);
break;

case '-': fans = num1 - num2;
printf("%4.2f - %4.2f = %4.2f\n", num1, num2, fans);
break;

case 'x':
case 'X': fans = num1 * num2;
printf("%4.2f x %4.2f = %4.2f\n", num1, num2, fans);
break;
case '/': if (num2 == 0) {
printf("Error: Cannot divide by zero.\n");
  }
          else {
fans = num1/num2;
printf("%4.2f / %4.2f = %4.2f\n", num1, num2, fans);
  }
break;

case '^': if (num1 == 0 && num2 <= 0) {
        printf("%f ^ %f can't be represented\n", num1, num2);
  }
  else {
fans = pow(num1, num2);
printf("%4.2f ^ %4.2f = %4.2f\n", num1, num2, fans);
  }
break;

default: printf("%c is not a valid selection\n", op);
break;
}
}
else if (len == 3) {
sscanf(my_string, "%c %f", &op, &num);

switch (op) {
case 'n':
case 'N': fans = num * -1;
printf("-(%4.2f) = %4.2f\n", num, fans);
break;

case 'a':
case 'A': fans = fabs(num);
printf("|%4.2f| = %4.2f\n", num, fans);
break;

case 's':
case 'S': if (num < 0) {
printf("Error: Can't find square root of negative number.\n");
  }
  else {
fans = sqrt(num);
printf("Sqrt(%4.2f) = %4.2f\n", num, fans);
  }
break;

default: printf("%c is not a valid selection\n", op);
break;
}
}
    }
}
Seeing this makes me realise how fucked I am for my own course because I can't code for shit.
bruh do not lose hope because i've been there. Both this semester and last I hit a wall where i was seriously considering chaning majors. Its all built around those basic building blocks. This program is nothing fancy just if, else, printf, etc. Its taken me two years to be to this point too you're only just now starting, you'll get there. ANYONE can code, trust me. Your biggest enemy in programming is overcomplicating things
I'm also interested in coding, but I want to specifically learn about AI and I don't really know where to start with that.


 
cxfhvxgkcf-56:7
| Marty Inconceivable!
 
more |
XBL:
PSN:
Steam:
ID: SoporificSlash
IP: Logged

15,656 posts
 
This user has been blacklisted from posting on the forums. Until the blacklist is lifted, all posts made by this user have been hidden and require a Sep7agon® SecondClass Premium Membership to view.


Epsira | Legendary Invincible!
 
more |
XBL:
PSN:
Steam: interiminitiator
ID: Epsira
IP: Logged

4,019 posts
 
just wrote my midterm for data structures fam

Code: [Select]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

int main(int argc, char * argv[]) {
char op, my_string[5];
float num, num1, num2, fans;
int len, i = 0;

if (argc == 4) {
sscanf(argv[1], "%f", &num1);
sscanf(argv[2], "%c", &op);
sscanf(argv[3], "%f", &num2);

switch (op) {
case '+': fans = num1 + num2;
printf("%4.2f + %4.2f = %4.2f\n", num1, num2, fans);
break;

case '-': fans = num1 - num2;
printf("%4.2f - %4.2f = %4.2f\n", num1, num2, fans);
break;

case 'x':
case 'X': fans = num1 * num2;
printf("%4.2f x %4.2f = %4.2f\n", num1, num2, fans);
break;
case '/': if (num2 == 0) {
printf("Error: Cannot divide by zero.\n");
  }
          else {
fans = num1/num2;
printf("%4.2f / %4.2f = %4.2f\n", num1, num2, fans);
  }
break;

case '^': if (num1 == 0 && num2 <= 0) {
        printf("num1 ^ num2 can't be represented\n");
printf("%4.2f ^ %4.2f = %4.2f\n", num1, num2, fans);
  }
  else {
fans = pow(num1, num2);
  }
break;

default: printf("%c is not a valid selection\n", op);
break;
}
}
else if (argc == 3) {
sscanf(argv[1], "%c", &op);
sscanf(argv[2], "%f", &num);

switch (op) {
case 'n':
case 'N': fans = num * -1;
printf("-(%4.2f) = %4.2f\n", num, fans);
break;

case 'a':
case 'A': fans = fabs(num);
printf("|%4.2f| = %4.2f\n", num, fans);
break;

case 's':
case 'S': if (num < 0) {
printf("Error: Can't find square root of negative number.\n");
  }
  else {
fans = sqrt(num);
printf("Sqrt(%4.2f) = %4.2f\n", num, fans);
  }
break;

default: printf("%c is not a valid selection\n", op);
break;
}
}

else {
printf("Proper input: \n\tnumber operator number\n\t operator number\nEnter your expression: ");
gets(my_string);
len = strlen(my_string);
 
if (len == 5) {
sscanf(my_string, "%f %c %f", &num1, &op, &num2);

switch (op) {
case '+': fans = num1 + num2;
printf("%4.2f + %4.2f = %4.2f\n", num1, num2, fans);
break;

case '-': fans = num1 - num2;
printf("%4.2f - %4.2f = %4.2f\n", num1, num2, fans);
break;

case 'x':
case 'X': fans = num1 * num2;
printf("%4.2f x %4.2f = %4.2f\n", num1, num2, fans);
break;
case '/': if (num2 == 0) {
printf("Error: Cannot divide by zero.\n");
  }
          else {
fans = num1/num2;
printf("%4.2f / %4.2f = %4.2f\n", num1, num2, fans);
  }
break;

case '^': if (num1 == 0 && num2 <= 0) {
        printf("%f ^ %f can't be represented\n", num1, num2);
  }
  else {
fans = pow(num1, num2);
printf("%4.2f ^ %4.2f = %4.2f\n", num1, num2, fans);
  }
break;

default: printf("%c is not a valid selection\n", op);
break;
}
}
else if (len == 3) {
sscanf(my_string, "%c %f", &op, &num);

switch (op) {
case 'n':
case 'N': fans = num * -1;
printf("-(%4.2f) = %4.2f\n", num, fans);
break;

case 'a':
case 'A': fans = fabs(num);
printf("|%4.2f| = %4.2f\n", num, fans);
break;

case 's':
case 'S': if (num < 0) {
printf("Error: Can't find square root of negative number.\n");
  }
  else {
fans = sqrt(num);
printf("Sqrt(%4.2f) = %4.2f\n", num, fans);
  }
break;

default: printf("%c is not a valid selection\n", op);
break;
}
}
    }
}
Seeing this makes me realise how fucked I am for my own course because I can't code for shit.
bruh do not lose hope because i've been there. Both this semester and last I hit a wall where i was seriously considering chaning majors. Its all built around those basic building blocks. This program is nothing fancy just if, else, printf, etc. Its taken me two years to be to this point too you're only just now starting, you'll get there. ANYONE can code, trust me. Your biggest enemy in programming is overcomplicating things
I'm also interested in coding, but I want to specifically learn about AI and I don't really know where to start with that.
Even something as complex as AI theory is still built upon the basic foundations of programming I.e. if else statements, while and for loops,  stacks, queues, etc.
Thanks. In your experience, are programming classes worthwhile experiences, or is self-education a better route?


 
cxfhvxgkcf-56:7
| Marty Inconceivable!
 
more |
XBL:
PSN:
Steam:
ID: SoporificSlash
IP: Logged

15,656 posts
 
This user has been blacklisted from posting on the forums. Until the blacklist is lifted, all posts made by this user have been hidden and require a Sep7agon® SecondClass Premium Membership to view.


 
 
Flee
| Marty Forum Ninja
 
more |
XBL:
PSN:
Steam:
ID: Flee
IP: Logged

15,686 posts
 
This user has been blacklisted from posting on the forums. Until the blacklist is lifted, all posts made by this user have been hidden and require a Sep7agon® SecondClass Premium Membership to view.


Epsira | Legendary Invincible!
 
more |
XBL:
PSN:
Steam: interiminitiator
ID: Epsira
IP: Logged

4,019 posts
 
All I have is academic stuff.
Still qualifies. My poems are for academic purposes, after all.

If I were writing a paper I'd share that... But I don't have any I'm working on atm.


 
 
Flee
| Marty Forum Ninja
 
more |
XBL:
PSN:
Steam:
ID: Flee
IP: Logged

15,686 posts
 
This user has been blacklisted from posting on the forums. Until the blacklist is lifted, all posts made by this user have been hidden and require a Sep7agon® SecondClass Premium Membership to view.
Last Edit: October 14, 2015, 12:39:45 PM by Flee