Small projects to learn Rust
List from http://www.cplusplus.com/forum/beginner/3473/
To run project from repo root: sh r.sh p1
If external crates are required, run: sh r2.sh p6
Beginner
- Write a program which finds the factorial of a number entered by the user. (check for all conditions).
- Develop a program to convert currency X to currency Y and vice versa.
- Write a program that prints out a triangle from largest to smallest; user inputs the largest number. Eg:
***
**
*
- Write a program that prints out a triangle from smallest to largest; user inputs bottom number. Eg:
*
**
***
- Print out a triangle from smallest to largest, skipping even rows. User inputs largest number, eg:
*
***
*****
- Develop a program that uses a randomly generated number to select 1 of 3 (or more) functions to show the user.
- Guessing game. ask the user to guess a number between 1 and a 100. If you guessed correctly, it will say you win. If you're too high or too low it will also let you know.
- Create a program which generates Fibonacci series til a number 'n', where 'n' is entered by the user. Eg if the user enters 10 then the output would be:
1 1 2 3 5 8
- Given a string, determine how many of the characters are vowels and how many are consonants. Terminate the string when the input character encountered is non-alphabetic.
- Find the Fifth root of the sum of the squares of the first 100 ODD numbers only.
- Write a program to simulate a simple calculator. It should accept two numbers from the user along with the required operation to be performed. Addition, subtraction, division and multiplication are the basic operations that should be implemented. Feel free to implement other operations. Bonus points for splitting the calculation functions into a separate module.
Intermediate
- Simple file encryption (using something simple like ROT13).
- Read XHTML, remove the tags, then print out the remaining text.
- Write a program which performs addition, subtraction, multiplication of matrices. The dimensions of both the matrices would be specified by the user (dynamic memory allocation required). Use of structure or a class to define the matrix would be a good idea.
- Create a sophisticated linked list class. You should be able to insert and delete nodes anywhere in the list, and the nodes should have pointers to nodes both in front and behind them.
- Create a command-line todo list with Clap. Users should be able to add, complete and delete items. Bonus: use a database (eg SQLite) to persist todo items between program runs.
Expert
- Make a Markov chain generator. Read text from a source, create a histogram and allow different prefix lengths. See Think Python for info.
- Create a binary tree which has search and sorting functions.
- Create a Quine, (a program that prints out its own source code).
My Rust resources:
Recommended resources for Rust:
- https://github.com/kud1ing/awesome-rust
- https://github.com/ctjhoa/rust-learning
- https://github.com/cis198-2016s
- http://fredrik.anderzon.se/2016/05/10/rust-for-node-developers-part-1-introduction/
- http://www.arewewebyet.org/#getting-started
- http://cglab.ca/~abeinges/blah/too-many-lists/book/
- https://www.reddit.com/r/rust/comments/5d4h8l/school_vacation_starts_tomorrow_i_want_to_know/da1zdiz/