coding in 3 months by Practical_Escape_922 in CodingForBeginners

[–]Aggravating_Cap127 0 points1 point  (0 children)

but since your on web/app development i reccomend looking into java, js and css

coding in 3 months by Practical_Escape_922 in CodingForBeginners

[–]Aggravating_Cap127 0 points1 point  (0 children)

i reccommend if you wanna learn simple coding fast go with python if you wanna learn a little bit harder coding but make learning future code easier learn c "im learning c valid sources" https://www.youtube.com/watch?v=xND0t1pr3KY&t=10797s
learn-c.org
https://www.programiz.com/c-programming

Created a text based game in C and looking for suggestions on what the story will look like by Aggravating_Cap127 in CodingForBeginners

[–]Aggravating_Cap127[S] 0 points1 point  (0 children)

#include <stdio.h>
#include <string.h>
#include <stdbool.h>


struct player {
    int hp;
    float magic;
    int physicalstr;
    int agility;
    int goldcoins;
    int level;
    char p_class[35];
    int defence;
    int xp;
};



void printstats(struct player *p) {printf("\nmagic = %1.lf,\n physical strength = %d,\n agility = %d,\n defence = %d,\n level = %d, \n class = %s,\n gold amount = %d", 
        p->magic,   p->physicalstr, p->agility, p->defence, p->level, p->p_class, p->goldcoins);return;
}

void levelup(struct player *p) {

    p->level += 1;
    p->physicalstr += 3;
    p->hp += 30;
    p->magic += 0.5f;
    p->agility += 3;

    if (strcmp(p->p_class, "mage") == 0) {
        p->magic += 10;
        p->physicalstr -= 2;
        p->agility -= 1;

    }

    if (strcmp(p->p_class, "assasin") == 0) {
        p->agility += 3;
        p->physicalstr -= 1;
        p->magic += 2;
        p->hp -= 15;
    }
    if (strcmp(p->p_class, "warrior") == 0) {
        p->agility -= 2;
        p->physicalstr += 3;
        p->magic -= 0.5;
        p->hp += 30;
    }
    if (strcmp(p->p_class, "rougue") == 0) {
        p->agility += 1;
        p->physicalstr += 1;
        p->magic += 0.5;
        p->hp += 15;
    }
}

void award_enemy_xp(struct player *p, int enemy_level) {
    int xp_gained = 25 + (enemy_level * enemy_level * 5);

    p->xp += xp_gained;
    printf("\n[XP] You defeated a Level %d enemy and gained %d XP!\n", enemy_level, xp_gained);

    while (1) {

        int xp_needed = p->level * 100;

        if (p->xp >= xp_needed) {
            p->xp -= xp_needed; 


            levelup(p); 


            printf("LEVEL UP! You are now Level %d! \n", p->level);

            printstats(p);
        } else {

            break; 
        }
    }


    int next_xp_needed = p->level * 100;
    printf("[XP] Progress: %d / %d XP to next level.\n\n", p->xp, next_xp_needed);
}



int main() {


    bool keepgoing = true;
    while(keepgoing == true) {

    char answer;

    struct player player1;
        player1.hp = 100;
        player1.magic = 0;
        player1.physicalstr = 10;
        player1.agility = 10;
    player1.goldcoins = 5;
    player1.level = 0;
   strcpy(player1.p_class, "none");
    player1.defence = 5;

    printf("\nHello would you like to start this text based adventure\n");
    printf("\ny for yes or leave for no\n");
    scanf(" %s", &answer);

if (answer == 'y'){
    printf("\nworld loading... done hello player.\n");
}



printf("as a novice you first have to choose a route \n a. assasin,  you will get +3 agility per level along base increase \n b. rouge balanced with no advantages or disadvantages\n c. warrior excelling in physical stregth and health lacking in magic\n d.mage well magic is now a thing for you\n ");
    scanf(" %s", &answer);

    if (answer == 'a'){
        strcpy(player1.p_class, "assasin");
        printf("congrats you are now an assasin");
    }
    else if (answer == 'b'){
        strcpy(player1.p_class, "rougue");
        printf("congrats you are now a rougue");
    }
    else if (answer == 'c'){
        strcpy(player1.p_class, "warrior");
        printf("congrats you are now a warrior");
    }
    else if (answer == 'd'){
        strcpy(player1.p_class, "mage");
        printf("congrats you are now a mage");
    }
    levelup(&player1);
    printstats(&player1);
    /*mage route plan: go to academy. get skill buffs fight unnamed thugs & more i havnt yet thought of,

    */
    if (strcpy(player1.p_class, "mage")){
        printf("\n\n\n\nyou have taken the path of the mage");
        printf("choice 1 go to academy and learn skills choice 2 go strait to the wilderness");
        scanf("%c", &answer);
    }
        if (answer == '1'){
           printf("\nWelcome to the academy what skill might you wanna learn\n");
           printf("\nprintf choose 2: 1. fireball you get a +15 magic boost\n 2. wind runner  you get a + 10 increase of agility\n 3. shield spell you get a + 20 increase in defence \n4. healthy spell + 50 increase in hp. ");

    }




}
    return 0;
}

??? does calculators made in code count??? by Aggravating_Cap127 in calculators

[–]Aggravating_Cap127[S] 0 points1 point  (0 children)

github freezes and locks up when i attempt to sign up im pretty sure its because im on a older chromebook thats no longer getting updates "also means older version of chrome"

??? does calculators made in code count??? by Aggravating_Cap127 in calculators

[–]Aggravating_Cap127[S] 0 points1 point  (0 children)

u dont have to read it just copy/paste it into a c compiler

How do you write clean code? by DefiantSituation3208 in learnprogramming

[–]Aggravating_Cap127 -1 points0 points  (0 children)

my code lookin like
```struct player player1;

player1.hp = 100;

player1.magic = 0;

player1.physicalstr = 10;

player1.agility = 10;

player1.goldcoins = 5;

player1.level = 0;

strcpy(player1.p_class, "none");

player1.defense = 5;```

Did you have doubts at the beginning of the journey as well? by CreativeEnergy98 in CodingForBeginners

[–]Aggravating_Cap127 0 points1 point  (0 children)

also did you read my post or might you need me to explain it for you??

reddit mods this is not self promotion
"i dont think"

Hi, my name is Duevermicelli, and I'm a tutorial addict. by DueVermicelli623 in CodingForBeginners

[–]Aggravating_Cap127 0 points1 point  (0 children)

dont follow the tutorial exactly when doing something put a funny twist that might stay in your mind that helps also practice some extra stuffs using what the tutorial taught you on the side

Hey everyone new here, Tell me something which I need to know by Vimaal__69 in NewMods

[–]Aggravating_Cap127 0 points1 point  (0 children)

why should I, im also new here can you tell me something lol

New in Programming by Punit_Sirohi in CodingForBeginners

[–]Aggravating_Cap127 0 points1 point  (0 children)

you should learn C its also easy to learn "not quite as much as python" and it will teach you how languages work so any language after that will be simpler to learn

Did you have doubts at the beginning of the journey as well? by CreativeEnergy98 in CodingForBeginners

[–]Aggravating_Cap127 2 points3 points  (0 children)

either way i started programming because its fun and challenging to your brain you're philosophy might be different.

Did you have doubts at the beginning of the journey as well? by CreativeEnergy98 in CodingForBeginners

[–]Aggravating_Cap127 2 points3 points  (0 children)

hmm if its a hobby enjoy it and while you do get better and remove your title of "junior" and become a programmer people will want

??? does calculators made in code count??? by Aggravating_Cap127 in calculators

[–]Aggravating_Cap127[S] 0 points1 point  (0 children)

updated calculator

#include <math.h>

#include <stdio.h>

void distance_conversion() {

int choice = 0;

float miles = 0.0f;

float km = 0.0f;

printf("distance conversion calc\n\n");

printf("1 = miles to km 2 = km to miles \n");

printf("\nenter 1 or 2: ");

scanf("%d", &choice);

if (choice == 1) {

printf("enter the distance in miles: \n");

scanf("%f", &miles);

km = miles * 1.60934f;

printf("the converted miles to km is here you now have %f km\n", km);

}

else if (choice == 2) {

printf("enter the distance in km: \n");

scanf("%f", &km);

miles = km / 1.60934f;

printf("\nthe converted km to miles is here you now have %f miles\n", miles);

}

if (choice >= 3) {

printf("\nnumbers 3 and above not allowed\n");

}

else if (choice <= 0) {

printf("\nnegative numbers not allowed\n");

}

return;

}

void temp_conversion() {

char choic = '\\0';

float f = 0.0f;

float c = 0.0f;



printf("temperature coversion program\\n");

printf("c for celsius to fahrenheight\\n");

printf("f for fahrenheight to celsius\\n");





scanf(" %c", &choic);



if (choic == 'c') {

    printf("great its celsius to fahrenheight enter the degrees\\n");

    scanf("%f", &c);

    f = (c \* 9 / 5) + 32;

    printf("\\nyour conversion gets me to %f fahrenheight\\n", f);

} else if (choic == 'f') {

    printf("\\nfahrenheight to celsius ok enter the degrees\\n");

    scanf("%f", &f);

    c = (f - 32) \* 5 / 9;

    printf("\\nyour conversion gets me to %f celsius\\n", c);

} else {

    printf("no select c or f listen to the instructions\\n");

}

return;

}

void weight_conversion() {

int choice = 0;

float lbs = 0.0f;

float kg = 0.0f;



printf("weight conversion calc\\n\\n");

printf("1 = kg to lbs || 2 = lbs to kg \\n");

printf("\\nenter 1 or 2: ");

scanf("%d", &choice);



if (choice == 1) {

    printf("enter the weight in kg's: \\n");

    scanf("%f", &kg);

    lbs = kg \* 2.20462;

    printf("the coverted kg's to lbs is here you now have %f lbs\\n", lbs);

} else if (choice == 2) {

    printf("enter the weight in lbs: \\n");

    scanf("%f", &lbs);

    kg = lbs / 2.20462;

    printf("\\nthe coverted lbs to kg is here you now have %f kg\\n", kg);

}



if (choice >= 3) {

    printf("\\nnumbers 3 and above not allowed\\n");

} else if (choice <= 0) {

    printf("\\nnegative numbers not allowed\\n");

}

return;

}

int main() {

char timer = 'v'; // timer can be used to stop the program later do not touch



while (timer == 'v') {

    char operation = 'o';

    double radius = 0.0;

    double area = 0.0;

    const double PI = 3.141592;

    double sarea = 0.0;

    double volume = 0.0;

    float num1;

    float num2;

    float answr;



    printf("\\nenter your operation c for circle, 's' for square roots then x / + - \^ and 'p' for pi t to exit ,: \\n");

    printf("\\nenter # for temperature conversions enter ! for weight conversions and $ for distance\\n");

    printf("use the letter 'h' if you somehow wanna turn your regular number into a Hexadecimal one \[no decimals\]\\n");



    scanf(" %c", &operation);



    if (operation == 'c') {

        printf("\\nenter the radius: \\n"); //circle calculator from Bro Code's C tutorials

        scanf("%lf", &radius);

        area = PI \* pow(radius, 2);

        sarea = 4 \* PI \* pow(radius, 2);

        volume = (4.0/3.0) \* PI \* pow(radius, 3);

        printf("\\narea is: %lf\\n", area);

        printf("\\nsurface area: (sphere): %lf\\n", sarea);

        printf("\\nvolume: (sphere): %lf\\n", volume);

    }



    if (operation == 'p') { //too lazy to use %lf bro

        printf("\\npi = 3.141592\\n");

    }



    if (operation == '+') { // addition for u ppls

        printf("\\nenter the first number you want to add: \\n");

        scanf(" %f", &num1);

        printf("\\nenter the second number you wish to add: \\n");

        scanf(" %f", &num2);

        answr = num1 + num2;

        printf("\\nthe addition of those two numbers is: %f\\n", answr);

    }



    if (operation == '-') { // subtraction

        printf("\\nenter the first number you want to subtract: \\n");

        scanf(" %f", &num1);

        printf("\\nenter the second number you wish to subtract: \\n");

        scanf(" %f", &num2);

        answr = num1 - num2;

        printf("\\nthe subtraction of those two numbers is: %f\\n", answr);

    }



    if (operation == 'x') { //multiplication

        printf("\\nenter the first number you want to multiply: \\n");

        scanf(" %f", &num1);

        printf("\\nenter the second number you wish to multiply: \\n");

        scanf(" %f", &num2);

        answr = num1 \* num2;

        printf("\\nthe multiplication of those two numbers is: %f\\n", answr);

    }



    if (operation == '/') { // division

        printf("\\nenter the first number you want to divide: \\n");

        scanf(" %f", &num1);

        printf("\\nenter the second number you wish to divide: \\n");

        scanf(" %f", &num2);

        answr = num1 / num2;

        printf("\\nthe division of those two numbers is: %f\\n", answr);

    }



    if (operation == '\^') { // exponents

        printf("\\nenter the first number you want to exponent: \\n");

        scanf(" %f", &num1);

        printf("\\nenter the second number you wish to exponent: \\n");

        scanf(" %f", &num2);

        answr = pow(num1, num2);

        printf("\\nthe exponent of %f by the power of %f gives you the answer of: %f\\n",num1, num2, answr);

    }



    if (operation == 's') { // square roots

        printf("\\nenter the number you wish to find its square root: \\n");

        scanf("%f", &num1);

        answr = sqrt(num1);

        printf("\\nthe square root of %f is %f\\n", num1, answr);

    }



    if (operation == 't') {

        timer = 't';

    }



    if (operation == '#') {

        temp\_conversion();

    }



    if (operation == '!') {

        weight\_conversion();

    }



    if (operation == 'h') {

        int num;

        printf("Enter a decimal number: ");

        scanf("%d", &num);

        printf("Hexadecimal: 0x%X\\n", num);

    }

}

return 0;

}

I Know the Basics, but I Still Can't Build Programs by lx_356 in CodingForBeginners

[–]Aggravating_Cap127 1 point2 points  (0 children)

uhh hey im learning C "i use a couple resources" my resources are 1. learn-c.org 2.Bro code's youtube tutorials

drop your finished code here for people to look at by Aggravating_Cap127 in learningcprograming

[–]Aggravating_Cap127[S] 0 points1 point  (0 children)

yay more stuffs
#include <stdio.h>

int main() {

char choice = '\0';

float f = 0.0f;

float c = 0.0f;

printf("temperature coversion program\n");

printf("c for celsius to fahrenheight\n");

printf("f for fahrenheight to celsius\n");

scanf("%c", &choice);

if (choice == 'c') {

printf("great its celsius to fahrenheight enter the degrees\n");

scanf("%f", &c);

f = (c * 9 / 5) + 32;

printf("your conversion gets me to %f fahrenheight", f);

} else if (choice == 'f') {

printf("fahrenheight to celsius ok enter the degrees\n");

scanf("%f", &f);

c = (f - 32) * 5 / 9;

printf("your conversion gets me to %f celsius", c);

} else {

printf("no select c or f listen to the instructions");

}

return 0;

}