80 likes | 207 Vues
Discover basic programming exercises using C++ in Visual Studio 2008. This guide walks you through how to create a simple project and includes two hands-on exercises: displaying a greeting message and swapping two integer values entered by the user. Each exercise includes clear solutions with coded examples to help you understand the syntax and functionality of C++. Perfect for beginners looking to strengthen their programming skills and familiarize themselves with the C++ language.
E N D
Blog : http://summercs240.wikisapces.com Software: Visual Studio 2008 .
Example #1 #include <iostream> using namespace std; int main() { cout << "Enjoy yourself with C++!" << endl; return 0; }
Exercise 1: • Write a program that display your “ Hello YOUR NAME “ • Solution : #include <iostream> using namespace std; int main() { cout << “Hello Aseel " << endl; return 0; }
Exercise 2: • Write a program to swap two integer numbers that entered from user • Solution : #include <iostream> using namespace std; int main() { int number1; int number2; cout<< "please enter first number : " << endl; cin >> number1; cout<< "please enter second number : " << endl; cin >> number2; cout<< "Numbers after swapping : " << number2 << " " << number1 << endl ; return 0; }