Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

43 Pages

day02

Course: EE 142, Spring 2009
School: Washington State
Rating:

Word Count: 1620

Document Preview

expressions, Data, and variables 1 How the computer sees the world Internally, the computer stores everything in terms of 1s and 0s Example: h 0110100 &quot;hi&quot; 01101000110101 104 0110100 How can the computer tell the difference between an h and 104? 2 Data types type: A category of data values Example: integer, real number, character C has many types (below is only a partial...

Register Now

Unformatted Document Excerpt

Coursehero >> Washington >> Washington State >> EE 142

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Washington State - EE - 142
The for loop and scope1RepetitionHow can we eliminate this redundancy?printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I printf(&quot;I pr
Washington State - EE - 142
Parameters1Repetitive figuresConsider the task of drawing the following figures:* * * * * * * * * * * * *The lines and figures are similar, but not exactly the same.2A solution?void DrawLineOf13Stars() { for (int i = 1; i &lt;= 13; i+)
Washington State - EE - 142
Functions that return values1Return valuesreturn: To send a value out as the result of a function, which can be used in an expression. A return value is like the opposite of a parameter. Parameters pass information in from the caller to t
Washington State - EE - 142
Conditionals1ConditionalsIf you eat your vegetables, then you can have dessert. If you do your homework, then you may go outside to play, or else youll be grounded for life.2The if statementif statement: A control structure that execu
Washington State - EE - 142
Boolean1True or false?bool: A type to represent Boolean values Must include stdbool.h Like any other type, you can create variables, parameters, and returns of type bool. Examples:bool minor = (age &lt; 21); bool iLoveCS = true; if (minor) { pr
Washington State - EE - 142
ExerciseWrite a program that reads a number from the user and tells whether it is prime, and if not, gives the next prime after it. Sample runs:(run #1) Type a number: 29 29 is prime (run #2) Type a number: 14 14 is not prime; the next prime afte
Washington State - EE - 142
The major ideas1Example conceptual questionConsider the following piece of code where a and b are Boolean variables: if (a &amp; b) { printf(&quot;Hi &quot;); } else if (b) { printf(&quot;there!&quot;); }Under what conditions will the code print out only &quot;there!&quot;
Washington State - EE - 142
Text processing1Characterschar: A type representing single characters. Individual characters inside a string are stored as char values. Literal char values are surrounded with apostrophe (single-quote) marks, such as 'a' or '4' or '\n' or '\'
Washington State - EE - 142
Pointers1What is a pointer?pointer: A type representing an address to another value elsewhere in the computer Pointer declaration, syntax: &lt;type&gt; *&lt;name&gt;; Example:int *pNumber; double *pAnother; / pointer to an int / pointer to a double
Washington State - EE - 142
More text processing1Strings and char *Recall that array names are simply the address of the first element of the array. This means that strings are nothing more than a pointer to some character (or char *). Starting from that character, you s
Washington State - EE - 142
Converting strings to integersThe string tokenizer returns character pointers (i.e., strings). If the string is actually a number, you might want to convert it.Function nameatoi(str) atof(str)Descriptionreturns the string parameter as an int;
Washington State - EE - 142
ExerciseWrite a program that accepts an input file containing integers representing daily high temperatures.Example input file: 42 45 37 49 38 50 46 48 48 30 45 42 45 40 48Your program should print the difference between each adjacent pair of
Washington State - EE - 142
Object-oriented concepts1ExerciseWrite a program to produce the following output:p1 is (7, 2) p1's distance from origin = 7.280110 p2 is (4, 3) p2's distance from origin = 5.000000 p1 is (18, 8) p2 is (5, 10)The formula to compute the dis
Washington State - EE - 142
Object initialization: constructors1Initializing objectsIt is tedious to have to construct an object and assign values to all of its data fields manually.Point p; p.x = 3; p.y = 8;/ tediousWe want something more like:Point p(3, 8); / b
George Mason - SOCI - 101
Religion I. What is religion? a. Durkheim: A religion is a unified system or beliefs and practices relative to sacred things, that is to say, things set apart and forbidden beliefs and practices which united into one single moral community called a c
George Mason - SOCI - 101
The Family 1. U.S. census bureau defines a family as a group of two or more people (one of whom is a householder) related by birth, marriage, or adoption and residing together; all such people (including subfamily economic property, sexual access amo
George Mason - ECON - 103
CHAPTER1What Is Economics?After studying this chapter you will be able to Define economics and distinguish between microeconomics and macroeconomics Explain the two big questions of economics Explain the key ideas that define the economic way o
George Mason - ECON - 103
Economics 103 Microeconomic Principles7:20-10:00 PM, Tuesday EveningGeorge Mason University Spring 2009E.C. Holt, InstructorGeorge Mason Rich in Economic Excellence GMU has two Nobel Laureates, both in Economics (only VA University with two) P
George Mason - SOCI - 101
The Mass Media I. The mass media include radio, commercial television, cable television, newspapers, magazines, sound recordings, and the computer a. Defining characteristic is that each involves a single source that produces messages for a mass of i
George Mason - SOCI - 101
Conflict Theory: A theory of Power I. Karl Marx (1818-1883) a. Opening line of The Communist Manifesto (1848) reads: They history of all hitherto existing society is the history of class struggle. i. Problem began with the introduction of private pro
George Mason - SOCI - 101
I. II.III.Quantitative and Qualitative Methods Quantitative Methods: A Six Step Process 1. Problem Generation and Specification i. Seek confirmation of a theoretical assumption ii.Seek confirmation of a popular assumption 2. Reviewing the Literat
George Mason - SOCI - 101
Qualitative Sociological Research I. II. III. IV. V. VI. VII. Unobtrusive Measures-doesnt seem like anything was done Physical Trace Analysis-going through someones trash Archival Records-historians Content AnalysisCase Studies-experimental college C
George Mason - SOCI - 101
CultureI. II. Culture is everything we think, do, and have as members of a society Culture shapes our personalities A. Iroquois, Italian and American Males (Iroquois can neither cry or laugh in public, Italians can do both, and Americans can just la
George Mason - SOCI - 101
Socialization and Personality I. Socialization implied that the individual acquires a commitment to the norms, values, beliefs, and behavioral patterns of his or her society. We internalize the expectations A. The sociologist holds that the individua
George Mason - SOCI - 101
Theories of Crime and Deviance If youre not found guilty, than you are not a criminal I. A Functionalist Theory of Crime and DevianceKai Erikson a. The Function of Deviance in Small Groups (article) b. The Wayward Puritans (book) i. Why Puritans? ii.
George Mason - SOCI - 101
Interaction, Groups, and Organizations I. Textbook has 5 types of interactions A. Exchange B. Cooperation C. Competition D. Conflict E. Coercion Components of interaction and of society A. Statusa position in society B. Types of Statuses 1.Ascribed v
George Mason - SOCI - 101
Social Stratification and Inequality I. What is Stratification and Inequality? a. Social Inequality is a hierarchy of statuses and rules that enable some people to have more than others b. Social Stratification is a structured ranking process by whic
George Mason - SOCI - 101
Symbolic interactionism Someone in the upper class would be more confident in giving orders Lower class not so much Language plays a part in social classes -Lower classed kids were socialized more into society -Being compared to lower class, lower cl
George Mason - SOCI - 101
Race and Ethnicity 1. The Concept of Race a. A race is a group within the human species that is identified by a society as presumably having certain biologically inherited physical characteristics. Race is a socially constructed concept. We really sh
George Mason - SOCI - 101
I. II.III.IV.V. VI.Power-The probability to get someone to do what you want them to do whether they want to or not. (Max Weber) Some Important definitions A. Democracy: A political system that gives power to the people as a whole B. Monarchy:
George Mason - ECON - 103
CHAPTER8Possibilities, Preferences, and ChoicesAfter studying this chapter you will be able to Describe a households budget line and show how it changes when prices or income change Make a map of preferences by using indifference curves and exp