Docsity

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

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.