how to start visual studio 2008 or 2010 (command-line program)

12
How to start Visual Studio 2008 or 2010 (command-line program)

Upload: thomas-goodwin

Post on 03-Jan-2016

247 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: How to start Visual Studio 2008 or 2010 (command-line program)

How to startVisual Studio 2008 or

2010(command-line program)

Page 2: How to start Visual Studio 2008 or 2010 (command-line program)

Run Visual Studio 2008 andcreate new project

Page 3: How to start Visual Studio 2008 or 2010 (command-line program)

1.Select console application

2.Insert project name3.Click OK

Page 4: How to start Visual Studio 2008 or 2010 (command-line program)

Visual Studio 2008Creating Command-Line

Program

4.Click “Next”

5. Select

6.Click “Finish”

Page 5: How to start Visual Studio 2008 or 2010 (command-line program)

Visual Studio 2008Creating Command-Line

Program

7.Click Mouse-right-buttonex1-1.c

8.Insert the name of C source file “ex1-1.c”

Page 6: How to start Visual Studio 2008 or 2010 (command-line program)

Visual Studio 2008Creating Command-Line

Program

Page 7: How to start Visual Studio 2008 or 2010 (command-line program)

Exercise 1

#include <stdio.h>

int main(){ printf(“Hello C Programming!\n”);

return 0;}

1. Run your Visual Studio 2008 or 2010.2. Create a new “project” and add a new C file to the project.3. Write following simple C code4. Build (F7)5. Execute (Ctrl F5)

Page 8: How to start Visual Studio 2008 or 2010 (command-line program)

Exercise 1

Page 9: How to start Visual Studio 2008 or 2010 (command-line program)

1(a). Write a program that will obtain the length and width of a rectangle from the user and compute its area and perimeter.(Use float type for all variables.)

Output Example :1.4 2.1 (------- keyboard user input)2.940000 , 7.000000

Page 10: How to start Visual Studio 2008 or 2010 (command-line program)

1(b). Write a program that reads in the radius( 반지름 ) of a circle and prints the circle’s diameter( 지름 ), circumference( 둘레 ), and area( 면적 ). Use the constant value 3.14159 for PI.

#include <stdio.h>

int main(){

float radius, diameter, circumference, area;

// put your code here// use scanf to get the value of radius// use printf to display the result of calculation.

}

Output Example :Get radius? 3.5diameter = 7.000000 , circumference = 21.991130 , area = 38.484477

Page 11: How to start Visual Studio 2008 or 2010 (command-line program)

2. Given the values of the int type variables x, y and z, write a program to rotate their values such that x has the value of y, y has the value of z, and z has the value of x.

Output Example :3 1 6 (---- keyboard user input)1 6 3

Page 12: How to start Visual Studio 2008 or 2010 (command-line program)

3(b). Write a program to read three integer numbers from keyboard and print out the largest number and the smallest number.

(Use if-else statements.)

3(a). Write a program that determines whether a given (user input) integer is odd or even and displays the number and description on the same line.

Ex)

if (a>b) { … } else { … }