notes:cprog
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:cprog [2017/08/28 14:40] – Escaped the // anusom2 | notes:cprog [2018/11/20 08:24] (current) – [Other] sdiarra | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======C/C++ Programming Course | + | <WRAP centeralign round box> |
+ | < | ||
+ | < | ||
+ | <fs 125%>Course Wiki Page</ | ||
+ | </ | ||
- | For help with wiki syntax: | + | ======Projects====== |
+ | ===cci0=== | ||
- | * [[http:// | + | ===dtr0=== |
- | * [[https:// | + | |
+ | ===sof0=== | ||
- | ===25 August=== | + | ===dow0=== |
- | #include < | + | ===mbe0=== |
- | -This is called a preprocessor directive, it aids the compiler in the early stages of compilation. | + | |
- | Comments can be added to computer programs to increase their readability. These can take the form of multiline comments which start with /*. This leads the processor to ignore all information until a */ set of tokens is reached. | + | ===cbf0=== |
- | < | + | ===cos0=== |
- | All c programs contain the following function: int main() | + | ===pnc0=== |
- | { | + | |
- | In this function int is the return value or data type. There are several types of data types, these include char, short int, int,long int and long long int. Main is the name of the function, and the parenthesis following that name indicate that this is indeed a function. A parameter, if a function operates on a certain parameter, could be put inside the parenthesis. | + | ===mbe1=== |
- | Programs should end with a return(0); This is a sort of check. If the program returns 0 it is running correctly. | + | ===pnc1=== |
- | C understands several logical operators, such as | + | ===gfo0=== |
- | -& or bitwise | + | |
- | -| or bitwise or which implies | + | ===oop0=== |
- | ^ or bitwise exclusive or which implies that for a statement | + | <color # |
- | >> | + | |
- | ! is a bitwise not. This implies | + | **Objective** |
+ | |||
+ | The objective of this project is to get a stronger grasp of object-oriented programming, | ||
+ | |||
+ | **Background** | ||
+ | |||
+ | Over the last few weeks we have covered multiple ways of implementing object oriented model; using the single file method of doing things, and multiple files method of doing things. Using that skill-set, you(we) must implement | ||
+ | |||
+ | **Scope** | ||
+ | |||
+ | For the scope of this project, as long as you implement a program | ||
+ | |||
+ | **Program** | ||
+ | |||
+ | Replicate the functionality of a calculator, with the ability | ||
+ | |||
+ | |||
+ | ======URLs====== | ||
+ | **String Formating(fprintf)** | ||
+ | http:// | ||
+ | |||
+ | **Standard Template Library** | ||
+ | http:// | ||
+ | |||
+ | |||
+ | **Vector Reference** | ||
+ | http:// | ||
+ | ======Notes====== | ||
+ | <color # | ||
+ | |||
+ | |||
+ | As a follow | ||
+ | <code> | ||
+ | unsigned long long int a_very_long_variable_name = some+expressions+here; | ||
+ | </code> | ||
+ | |||
+ | an optimization for this line would be the following: | ||
+ | |||
+ | < | ||
+ | |||
+ | typedef unsigned long long int ulli_t; | ||
+ | ulli_t a_very_long_variable_name = some+expressions+here; | ||
+ | |||
+ | //much cleaner than the above version(could be better) | ||
+ | |||
+ | </ | ||
+ | |||
+ | Although **typedef** appears to be defining only types, it removes some overheads down the road as a developer, | ||
+ | |||
+ | ------- | ||
+ | <color # | ||
+ | |||
+ | Undef is a directive | ||
+ | |||
+ | < | ||
+ | #define pprintf1() //for pretty-printf | ||
+ | #undef pprintf1() | ||
+ | </ | ||
+ | |||
+ | easy peasy! | ||
+ | ======Other====== | ||
+ | ------- | ||
+ | <color # | ||
+ | |||
+ | Recently I have discovered a trick that could help run scripts much quicker with direct access to one's lab46 account, without working only on a single machine at a time. Ultimately, I had to ssh into my account, and whenever I left the terminal open for a few minutes, it would go offline - or had to share scripts between my personal laptop and lab46 machines, and work on projects on one machine at a time(fairly painful). With this method one can easily call commands anywhere, that are otherwise only available on the lab46 account. Here is how it is accomplished: | ||
+ | < | ||
+ | system(" | ||
+ | </ | ||
+ | A working example would be the following: | ||
+ | < | ||
+ | // | ||
+ | | ||
+ | |||
+ | // | ||
+ | |||
+ | </ | ||
+ | **Note that the script would prompt you to enter your <color # |
notes/cprog.1503945603.txt.gz · Last modified: 2017/08/28 14:40 by anusom2