New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

C++ General Tips

by: Maury Johnson

C++ General Tips Cmpsc 121

Maury Johnson
Penn State

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

These notes are a general overview of the application of C++. You should know basic C++ coding like: #include iostream using namespace std, int main(void){}, return, functions, and if else statements.
Intro to CS Majors 1
Professor Joseph Brian Adams
c++, object oriented programming, C#, java, HTML, JavaScript, Computer Science, programming, program, Programming Techniques, Programming Basics.
75 ?




Popular in Intro to CS Majors 1

Popular in Computer Science and Engineering

This 3 page Bundle was uploaded by Maury Johnson on Saturday February 27, 2016. The Bundle belongs to Cmpsc 121 at Pennsylvania State University taught by Professor Joseph Brian Adams in Spring 2016. Since its upload, it has received 38 views. For similar materials see Intro to CS Majors 1 in Computer Science and Engineering at Pennsylvania State University.

Similar to Cmpsc 121 at Penn State

Popular in Computer Science and Engineering


Reviews for C++ General Tips


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 02/27/16
Maury Johnson Penn State University Professor Joseph Brian Adams Computer Science 121 (Intro to C++ Programming) Bundle General Information(All Chapters) Memory Types Data type Memory Size Range of Values Short 2 bytes ­32,768 ­> 32,767 (2^­15 ­> (2^15)­1) Unsigned Short 2 bytes 0 ­> 53,535 (0­>(2^16)­1) Integer 4 bytes ­2,147,483,648 ­> 2,147,483,647 (­2^31 ­> (2^31)­1) Unsigned Integer 4 bytes 0 ­> 4,294,967,295 (0­ >(2^32)­1) Long 4 bytes ­2,147,483,648 ­> 2,147,483,647 (­2^31 ­> (2^31)­1) Unsigned Integer 4 bytes 0 ­> 4,294,967,295 (0­ >(2^32)­1) Global Variables (Program) #include <iostream> using namespace std; double newFunction(double); double GlobalVariable; Int main(void){ GlobalVariable = 3.0; double result = newFunction(); return 0; } double newFunction(void){ double result = globalVariable*4.0; Maury Johnson Penn State University Professor Joseph Brian Adams Computer Science 121 (Intro to C++ Programming) Bundle return result; } Flags If temperature is above 250 degrees if statement will cout the prompt. #include <iostream>  using namespace std; int main(void){ Double temperature = ­99.9; Bool highTemp = false; highTemp = (temperature>250) if(highTemp) { cout<<”warning High Temperature”<<endl; } return 0; } Default Variables #include <iostream>  using namespace std; void newFunction(void){ static int functioncalls; functioncalls++ //++ is +1 return; } //The lifetime of the function is the lifetime of the program. The variable is kept in memory after  the function returns. //If you use default arguments, all arguments after the first one must have defaults. Maury Johnson Penn State University Professor Joseph Brian Adams Computer Science 121 (Intro to C++ Programming) Bundle //once variable is excluded from the argument list, you must exclude all those that follow it. //Be cautious in how you order defaults. Reference Variables //You indicate you want to pass by reference by adding an ampersand “&” after the datatype in  the prototype, and before the variable name in the function definition. void addToSum(double&,double); void addToSum(double&s,doublef){ //ADDTOSUM //Add f to the current sum s = stf; Return; } //Function Call addToSum(sum,newValue);


Buy Material

Are you sure you want to buy this material for

75 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Allison Fischer University of Alabama

"I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.