Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    matrixbot
    @matrixbot
    . ¦3<RELATIVISM have you tried using cs50 help lib?
    AnishGhule-Technogeek
    @AnishGhule-Technogeek
    @matrixbot paste.debian.net/ rejects to input the code. Can you please provide the link to cs50 help lib? I tried using help50, but it didn't help
    AnishGhule-Technogeek
    @AnishGhule-Technogeek
    @matrixbot Are you referring to https://manual.cs50.io/ ?
    matrixbot
    @matrixbot
    . ¦3<RELATIVISM why are thhe prerelease lectures double the time in 2020 comparing to 2019
    Nate M
    @WhipStreak23
    What do you mean? Is it possible just running over everything and later just refining the notes.
    khan786-dev
    @khan786-dev
    Hi every one...?
    how did i go about my hospital management system project . I have some confusion about my project .i don't know from where i start my project to go throughout the end.I need help and guidance
    bdpenski
    @bdpenski
    Dropping a, "Hello," as I am new to the course. I'm also very new to coding and computers in general, so any advice is welcome. Happy studying, everyone!
    RuweidoF
    @RuweidoF_twitter
    Hi everyone Can someone help me with projects 0 & 1 .....?
    matrixbot
    @matrixbot
    . ¦3<RELATIVISM RuweidoF (Gitter): what do you need help with? dont ask to ask and you get more responses
    Shishir Modi
    @ShishirModi
    Hey there! I needed help with submitting the projects
    No-Face23
    @No-Face23
    @ShishirModi yeah fire away
    beccklly115
    @beccklly115
    i need help to upload my project to pc
    Ghost
    @ghost~5f9dbc18d73408ce4ff2fed0
    How do I use the debugger in the IDE?
    Ghost
    @ghost~5f9dbc18d73408ce4ff2fed0
    i got it
    Ghost
    @ghost~5fa82577d73408ce4ff39080
    H
    Ikechukwu Godwin
    @Ikechuk89511135_twitter
    hello
    matrixbot
    @matrixbot
    . ¦3<RELATIVISM o/ Ikechukwu Godwin (Gitter)
    fuegopazzo
    @fuegopazzo

    Hi, I'm having issues with pset3 , Plurality and check50 . Hi, I cannot find any problem with my code. It seems to do everything that is supposed to do.
    Here's the code:

    // cs50 2020
    //PSET 3 Plurality
    // takes count of user defined number of
    //voters in election and returns result
    //

    include <cs50.h>

    include <stdio.h>

    include <string.h>

    // Max number of candidates

    define MAX 9

    // Candidates have name and vote count
    typedef struct
    {
    string name;
    int votes;
    }
    candidate;

    // Array of candidates
    candidate candidates[MAX];

    // Number of candidates
    int candidate_count;

    // Function prototypes
    bool vote(string name);
    void print_winner(void);

    int main(int argc, string argv[])
    {
    // Check for invalid usage
    if (argc < 2)
    {
    printf("Usage: plurality [candidate ...]\n");
    return 1;
    }

    // Populate array of candidates
    candidate_count = argc - 1;
    //checks if candidate numberis above MAX
    if (candidate_count > MAX)
    {
        printf("Maximum number of candidates is %i\n", MAX);
        return 2;
    }
    //assigns location in array
    for (int i = 0; i < candidate_count; i++)
    {
        candidates[i].name = argv[i + 1];
        candidates[i].votes = 0;
    }
    
    int voter_count = get_int("Number of voters: ");
    
    // Loop over all voters
    for (int i = 0; i < voter_count; i++)
    {
        string name = get_string("Vote: ");
    
        // Check for invalid vote
        if (!vote(name))
        {
            printf("Invalid vote.\n");
    
        }
    }
    
    // Display winner of election
    print_winner();

    }

    // Update vote totals given a new vote
    bool vote(string name)
    {

    for(int i = 0; i < candidate_count; i++)
    {
        if (strcmp(name,candidates[i].name) == 0)
        {
          candidates[i].votes++;
    
    
          return true;
        }
    
    }
    return false;

    }

    // find and store highest vote total
    void print_winner(void)
    {
    int record = 0;
    for (int i = 0; i < candidate_count; i++)

    {
    if ( candidates[i].votes > record)
    {
    record = candidates[i].votes;
    }
    }
    //print winners

    //printf("The winner is/are: \n");

    for (int i = 0; i < candidate_count; i++)
    {
    if (candidates[i].votes == record)
    {
    printf("%s \n", candidates[i].name);

       }

    }
    return;
    }

    I get these errors from check50
    :( print_winner identifies Alice as winner of election
    print_winner function did not print winner of election
    :( print_winner identifies Bob as winner of election
    print_winner function did not print winner of election
    :( print_winner identifies Charlie as winner of election
    print_winner function did not print winner of election
    :( print_winner prints multiple winners in case of tie
    print_winner function did not print both winners of election
    :( print_winner prints all names when all candidates are tied
    print_winner function did not print all three winners of election

    Any help would be most appreciated

    matrixbot
    @matrixbot
    . ¦3<RELATIVISM fuegopazzo (Gitter): nextime usea pastebin is easier for people to check your code
    fuegopazzo
    @fuegopazzo
    Sorry, it's my first time
    matrixbot
    @matrixbot
    . ¦3<RELATIVISM no worries use maybe paste.debian.net
    . ¦3<RELATIVISM is a good, or bpa.st one or is also trusted
    . ¦3<RELATIVISM fuegopazzo (Gitter):
    White Witcht
    @BlackGameNeon
    I am starting the course today!
    matrixbot
    @matrixbot
    . ¦3<RELATIVISM 0/
    Muhammad Assem
    @Muhammad-Elgharably
    How could i submit my assignments on github?
    matrixbot
    @matrixbot
    . ¦3<RELATIVISM is called a pull request Muhammad Assem (Gitter)
    . ¦3<RELATIVISM seach for that term
    . ¦3<RELATIVISM usually you change something and just ask for people to pull from your repositorie
    . ¦3<RELATIVISM I can be wrong though given I never submited it
    . ¦3<RELATIVISM there is also a package called submit50, which might be for that
    . ¦3<RELATIVISM Hopefully this helped cheers
    segsman007
    @segsman007

    Good day friends. Please i need help to solve my compilation, i keep getting these error, what could be wrong?

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    <builtin>: recipe for target 'cash' failed
    make: * [cash] Error 1

    /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../x86_64-linux-gnu/crt1.o: In function _start': (.text+0x20): undefined reference tomain'
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    <builtin>: recipe for target 'cash' failed
    make: * [cash] Error 1

    charlottesilver11
    @charlottesilver11
    Hi all! I am having trouble with project 0's I'm Feeling Lucky. Can anyone help me figure out what is wrong in my code?: <button type="submit" value="Google Search" >Google Search</button>
    <button type="submit" value="I'm Feeling Lucky" name="btnI">I'm Feeling Lucky</button>
    no matter which 'I' I use, (uppcase i or l), the button will only work the same as google search
    Toqeer Abbas
    @Toqeer__Abbas_twitter
    i think you need to save file first then reload it.
    Joaocastroferreira84
    @Joaocastroferreira84
    Good morning from Portugal
    omeradrees
    @omeradrees_twitter
    Good morning from Pakistan. Just joined CS50 understanding technology course. Really excited. Gotta make the best of these times of pandemic. Hope everyone is safe and healthy. Shout out to the boss, David. HEYA
    . ¦3<RELATIVISM
    @sk-alexis:envs.net
    [m]
    ola @Joaocastroferreira84
    estas a fazer que curso? o primeiro ou o de pythonjavascript etc?
    sempre que precisares podesme fazer um ping.
    ZekeDami
    @ZekeDami
    hello everyone
    am having issue with my project 0 degrees
    . ¦3<RELATIVISM
    @sk-alexis:envs.net
    [m]
    feel free to ask @ZekeDami
    o/ btw
    kirti rawal
    @kirtirawal
    Hello Everyone, I am Kirti Rawal.I am new to ths community.
    . ¦3<RELATIVISM
    @sk-alexis:envs.net
    [m]
    o/ @kirtirawal welcome!
    kirti rawal
    @kirtirawal
    Hello everyone!