Lab3 - ECS 102 Lab 3 Name(s)_ Section 1 (3:45) Spring 2011...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ECS 102 Lab 3 Spring 2011 Name(s)__________________________________ Section 1 (3:45) Section 2 (12:45) (Lab 2 is online, if you need to recall how to do something you learned last time.) See the link for using Xcode if you are doing this on a Mac. I. Input, output, and format strings. 1. In Windows, navigate to Visual Studio 2010/Projects/labs. Double click on labs.sln to open it. This is the procedure you will use each time you open your labs project. 2. Select Project | Add New Item . As before, create a file, (left panel Code , right panel C++ file , make sure the location is the labs folder, type in the name including the .c ) ExploreDataTypes.c . In the Solution Explorer window you should now see two programs in the Source folder. (Click on the + next to the Source folder to see what is inside. You can click on the - to close it up again.) Right click on the old program (hello.c or MilesToKM.c) and select remove . The old program will still be inside the Labs folder, but it will no longer be considered part of the project. 3. Enter the following code. (You can cut and paste from the website.) /* ExploreDataTypes.c Using int, double, and char data in printf assignments scanf */ #include <stdio.h> /* for scanf, printf */ int main(void) { /* declarations */ int wholenumA=100; /* 100 is an integer constant. */ int wholenumB=-37; double realnum; char letter; /* Assign values. */ realnum=3.14; /* This is an assignment. 3.14 is a double constant. */ letter='M'; /* In a program a character value must be in single quotes. 'M' is a character constant. */
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
/* Display some values on the monitor. */ /* For output (printf) use %d for an integer placeholder %lf for a double placeholder %c for a char placeholder */ printf("A whole number goes here: %d", wholenumA); printf("Backslash n advances to a new line.\n");
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/05/2011 for the course EEE 212 taught by Professor Des during the Spring '11 term at Syracuse.

Page1 / 7

Lab3 - ECS 102 Lab 3 Name(s)_ Section 1 (3:45) Spring 2011...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online