Converting Miles to Kilometers using C++ in Microsoft Visual Studio - Prof. Kai Qian, Study notes of Programming Languages

Step-by-step instructions on how to write and run a c++ program in microsoft visual studio to convert miles to kilometers. The code takes user input for miles and calculates the equivalent distance in kilometers using the conversion factor.

Typology: Study notes

Pre 2010

Uploaded on 08/03/2009

koofers-user-0nw-1
koofers-user-0nw-1 🇺🇸

10 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Demo : Distance.cpp
1. Click “start” “programs” ”Microsoft Visual Studio 2005” ” Microsoft
Visual Studio 2005”
2. Click “File” “New”” “Project” .
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Converting Miles to Kilometers using C++ in Microsoft Visual Studio - Prof. Kai Qian and more Study notes Programming Languages in PDF only on Docsity!

Demo : Distance.cpp

  1. Click “start”  “programs” ”Microsoft Visual Studio 2005” ” Microsoft Visual Studio 2005”
  2. Click “File”  “New””  “Project”.
  1. Select “Visual C++” and “Win32 Console Application” and Name the project as “Distance”. Click “OK” button.
  1. Delete all the lines in the page displayed and enter the follow”ing lines of code. // distance.cpp #include<stdio.h> #include<stdafx.h> #include"conio.h" int main() { float kms , miles ; printf("\n Please Enter the Distance in miles to be converted to kms :"); scanf("%f" , & miles); kms = (miles* 8)/5; printf("\n The Equivalent distance in kms : %f" , kms ); getch(); return(0); }
  1. Now” that w”e are done w”ith w”riting the code, Click “File”  “Save Distance.cpp”.
  2. Now” to compile the code click “Build” ” Build Distance”.
  3. To Run the application click “Debug”  “Start Debugging” as follow”s

Demo : Distance.cpp

  1. Click “start”  “programs” ”Microsoft Visual Studio .NET 2005” ” Microsoft Visual Studio .NET 2003”
  2. Click “File”  “New””  “Project”.
  1. Select “Visual C++ Projects” and “Win32 Console Project” and Name the project as “Distance”. Click “OK” button.
  1. Now” that w”e are done w”ith w”riting the code , Click “File”  “Save Distance.cpp”.
  2. Now” to compile the code click “Build” ” Build Distance”.
  1. To Run the application click “Debug”  “Start” as follow”s
  2. In the opened w”indow” Enter any miles to be converted to miles and then press “enter” button.