C++ Programming
NOTES ON C++ PROGRAMMING
Module 1: Pointers and Memory Management
NOTES ON C++ PROGRAMMING
Module 1: Pointers and Memory Management
TABLE OF CONTENTS
TABLE OF CONTENTS 1
OVERVIEW 4
BASIC MEMORY MANAGEMENT 5
GROUP ASSIGNMENT 6
INITIALIZATION 8
CONSTANTS 9
INCREMENT AND DECREMENT OPERATORS 10
ELSE-IF 13
SWITCH 14
LOOPS 15
EXAMPLES OF LOOPS 16
BREAK, CONTINUE 18
RETURN 19
FUNCTION DEFINITION: 21
VOID FUNCTIONS 22
FUNCTIONS RETURNING A VALUE 23
OVERVIEW
Algorithms:
A step-by-step sequence of instructions that describes how to perform a computation.
Answers the question "What method will you use to solve this computational problem?"
Flowcharts:
Provides a pictorial representation of the algorithm using the symbols.
Structure Charts:
Provides a pictorial representation of the modules contained in the program.
Programming Style:
Standard form:
Function names starts in column 1 and is placed with the required parentheses on a line by itself.
The opening brace of the function body follows on the next line and is placed under the first letter of the function name.
The closing brace is placed by itself in column 1 as the last line of the function.
The final form of your programs should be consistent and should always serve as an aid to the reading and understanding of your programs.
Comments:
Explanatory remarks made within a program. Help clarify what the complete program is about, what a specific group of statements is meant to accomplish, or what one line is intended to do.
Top-Down Program Development:
1. Determine the desired output items that the program must produce.
2. Determine the input items
3. Design the program as follows:
a. Select an algorithm for transforming the input items into the desired outputs.
b. Check the chosen algorithm, by hand, using specific input values.
4. Code the algorithm into C.
5. Test the program using selected test data.
BASIC MEMORY MANAGEMENT
Space set aside for the variable:
Characters 1 byte (8 bits)
Pointers 4 bytes
Integers 2 bytes (16 bits) or 4 bytes (32 bits)
Short int or short 2 bytes
Unsigned int or unsigned 2 bytes
Long Integers 4 bytes
Floats 4 bytes(single precision, about 7 decimal places)
Doubles 8 bytes(double precision, about 15 decimal places)
Type Space
a) double *values; __________________ ________________________
b) long x[1000]; __________________ ________________________
c) char *s = "string"; __________________ ________________________
d) char s[] = "string"; __________________ ________________________
e) char *name [10]; __________________ ________________________
For more information about all elements of APA formatting, please consult the APA Style Manual, 6th Edition.
Aim: My aim is to find out how the number of rows and columns in a
Banning books from public schools and public libraries is wrong. It’s irrational to have a parent or school board member’s opinion determine what a school district should be reading. Books including and not limited to, The Scarlet Letter, The Great Gatsby, To Kill a Mockingbird, The Lord of the Flies, and Animal Farm all have one thing in common. They have all at one time or another been subject to banishment. These literary classics have been around for a long time and proved to be vital to the education of many, especially children and adolescents. These novels teach values and educate children about world affairs that can not come from an everyday experience. These controversial novels encompass the materials that ultimately boost our educational wealth. Banning books infringe
In America alone, we have the highest prison population in the world. There are about 2,200,000 Americans incarcerated in jails,
Mass incarceration has put a large eye-sore of a target on the United States’ back. It is hurting our economy and putting us into more debt. It has considerable social consequences on children and ex-felons. Many of these incarcerations can be due to the “War on Drugs”. We should contract the use of incarceration.
According to the Bureau of Justice Statistics, in the year 1980 we had approximately 501,900 persons incarcerated across the United States. By the year 2000, that figure has jumped to over 2,014,000 prisoners. The current level of incarceration represents the continuation of a 25-year escalation of the nation's prison and jail population beginning in 1973. Currently the U.S. rate of 672 per 100,000 is second only to Russia, and represents a level of incarceration that is 6-10 times that of most industrialized nations. The rise in prison population in recent years is particularly remarkable given that crime rates have been falling nationally since 1992. With less crime, one might assume that fewer people would be sentenced to prison. This trend has been overridden by the increasing impact of lengthy mandatory sentencing policies.
Parenthetical referencing is a citation style in which partial citations are enclosed in parentheses and embedded in the text. Scientific journal articles primarily make use of the “author-date system”. This system includes the authors last name, publication year, and page number(s) when a source is referred to. There are variations in what to put in the parentheses depending on how the source was introduced in-text. For example, Etelälahti and Eriksson’s (2014) use of parenthetical to introduce the author in-text like this, “…in our recent study (Etelälahti and Eriksson, 2013) and the previous study by Johansson et al. (2000)” and “This dose corresponds to the BA content in the commercial product Deca-Durabolin used by Johansson et al. (2000).”
Overcrowding in our state and federal jails today has become a big issue. Back in the 20th century, prison rates in the U.S were fairly low. During the years later due to economic and political factors, that rate began to rise. According to the Bureau of justice statistics, the amount of people in prison went from 139 per 100,000 inmates to 502 per 100,000 inmates from 1980 to 2009. That is nearly 261%. Over 2.1 million Americans are incarcerated and 7.2 million are either incarcerated or under parole. According to these statistics, the U.S has 25% of the world’s prisoners. (Rick Wilson pg.1) Our prison systems simply have too many people. To try and help fix this problem, there needs to be shorter sentences for smaller crimes. Based on the many people in jail at the moment, funding for prison has dropped tremendously.
“It is said that no one truly knows a nation until one has been inside its jails. A nation should not be judged by how it treats its highest citizens, but its lowest ones” (Nelson Mandela, 1994). The United States of America has more people behind bars than any other country on the planet. The prisons are at over double capacity. It cost a lot of money to house prisoners each year. A large number of the prisoners are there because of drug related offenses. There are prisoners who have been sent to prison for life for marijuana related drug offenses. Many prisoners have been exonerated after spending many years behind bars due to the corruption in our legal system. 32 States in United States of America still execute prisoners even though there is no evidence to suggest that capital punishment is a deterrent. Prison reform is needed in America starting at the legal system and then ending the death penalty.
Book banning in the United States and anywhere else in the world I feel should be abolished. Books are published and written for a reason. The reason is to expand the mind to new things. Sure some books are better than others but there is no reason to challenge or ban books.
Denison. B. (2002, January 1). A Basic Overview of Japanese Culture . . Retrieved May 3, 2014, from http://www.mizukan.org/articles/culture.htm
Overcrowding of prisons due to mass incarceration is among one of the biggest problems in America, mass incarceration has ruined many families and lives over the years.America has the highest prison population rate , over the past forty years from 1984 until 2014 that number has grown by four hundred percent .America has four percent of the world population ,but twenty-five percent of the world population of incarcerated people Forty one percent of American juveniles have been or going to be arrested before the age of 23. America has been experimenting with incarceration as a way of showing that they are tough on crime but it actually it just show that they are tough on criminals. imprisonment was put in place to punish, criminals, protect society and rehabilitate criminals for their return into the society .
2. Also when quoting you must always place in parentheses the name of the author and the page on which the quote can be found. This way your readers can look up the quotes for themselves.
3. When quoting, the parentheses, which hold the page number, should come after the quotation marks and the punctuation should come after the parentheses. An example of a correctly cited quote would be “A spell was broken” (251). Instead of “a spell was broken (251)”.
Western Washington University (2011). US / Japan culture comparison. Retrieved February 9, 2014, from www.wwu.edu/auap/english/gettinginvolved/CultureComparison.shtml