User Tools

Site Tools


notes:cprog

This is an old revision of the document!


Table of Contents

Corning Community College

CSCS1320 C/C++ Programming

Course Wiki Page

Projects

cci0

dtr0

sof0

dow0

mbe0

cbf0

cos0

pnc0

mbe1

pnc1

gfo0

oop0

CALCULATOR::Object-Oriented Programming

Objective

The objective of this project is to get a stronger grasp of object-oriented programming, get a better understanding of inheritance, and classes and their properties.

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 a program that will replicate the functions of a calculator.

Scope

For the scope of this project, as long as you implement a program that adopt the object-oriented methodology in C++ - there are no other particular restrictions.

Program

Replicate the functionality of a calculator, with the ability to accomplish multiple mathematical functions. Given a set of inputs the program must have the capability to compute the numbers based on the functions.

URLs

Notes

TYPEDEF

As a follow to our discussion this week, typedef is a naming convention used in C/C+, its primary use case is to declare various data-types. Defining data types in C can be a tedious task, some data types and variables names only can up to 1/2 of an 80-85char line of code, which ultimately will result in either unreadability, or some very extensive lines. Here is a brief example of how typedef could come in handy.

unsigned long long int a_very_long_variable_name = some+expressions+here;

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,it provides consistency, and clarity when used effectively.

Other


Quick Tip:

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 a single. 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 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("ssh account@lab47.corning-cc.edu command_here");

A working example would be the following:

     //From my own laptop
     system("ssh user@lab46.corning-cc.edu status cprog")
     
     //This example would return grades from the user.

Note that the script would prompt you to enter your password.

notes/cprog.1542336625.txt.gz · Last modified: 2018/11/15 21:50 by sdiarra