Giter Site home page Giter Site logo

ahmedbaligh / cs50 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 30.75 MB

Solutions to problem sets and labs from my participation in CS50x 2020.

C 33.98% Makefile 0.42% Python 13.59% HTML 46.57% CSS 4.79% JavaScript 0.66%
cs50 cs50x cs50problemsets c algorithms data-structures python sql html css

cs50's Introduction

CS50 Problem Sets

This repository contains my own solutions to weekly problem sets in CS50, Harvard University's introduction to the intellectual enterprises of computer science and the art of programming.

CS50 Library for C

Library Installation

curl -s https://packagecloud.io/install/repositories/cs50/repo/script.deb.sh | sudo bash
sudo apt-get install libcs50

or refer to CS50 Library for C for more information.

Library Usage

Now, to use the CS50 Library in your C programs, just write #include <cs50.h> atop your code.

Clang Installation

Install the Clang compiler on Linux:

sudo apt install clang

Enable CS50-specific Commands

make Command

The make command simplifies the process of compiling your C source code.

Run the following scripts to add these necessary environment variables to the end of .bashrc file in Ubuntu.

echo 'export CC="clang"' >> ~/.bashrc
echo 'export CFLAGS="-fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow"' >> ~/.bashrc
echo 'export LDLIBS="-lcrypt -lcs50 -lm"' >> ~/.bashrc

To reload the file, use:

source ~/.bashrc

Usage

Now you can compile your C source code using:

make <your_file_name>

help50 Command

The help50 command can be used to help you identify errors that arise, when compiling our code.

Make sure you have Python 3.6 or higher installed, then run the following:

pip3 install help50

Usage

help50 make <your_file_name>

check50 Command

The check50 command is used to give you automatic feedback on the correctness of your code, as it compares your code to pre-written tests in a git repo, if the checks exist for this certain CS50 problem set.

Make sure you have Python 3.6 or higher installed, then run the following:

pip3 install check50

Usage

You need to know the the slug of the certain problem set you want to check. For instance, this here:

check50 cs50/problems/2020/x/credit

checks the correctness of CS50x Credit problem set from Week 1.

CS50 Library for Python

Firstly make sure that you have the latest version of Python3 installed. If you do not, simply execute:

sudo apt-get update
sudo apt-get install python3.8 python3-pip

Library Installation

pip3 install cs50

Library Usage

Now, to use the CS50 Library in your Python programs, you can just import the entire library by putting import cs50 at the top in your Python program, or you could import specific functions (e.g. get_string()) using from cs50 import get_string.

SQLite Installation

Install the SQLite Database Mangement System on Linux:

sudo apt install sqlite3

cs50's People

Contributors

ahmedbaligh avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

mo7s0samer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.