شيئية OOP
281 subscribers
53 photos
10 files
12 links
عمي رحمة لوالديك ولعشيرتك وللعزاز وللعراق وللشرق الأوسط، لا تكعد تحفظ الأكواد
الكود فهم فهم فهم مو حفظ
و السلام
Download Telegram
Channel created
Q1: Write a C++ code to swap two integer numbers and find the sum of them (use temp variable).

#include <iostream>
using namespace std;

int main()
{
int a, b, temp;
cout<<"enter the value of a ";
cin >> a;
cout<<"enter the value of b ";
cin >> b;

cout<< " before a = "<<a<<", b = "<<b<<endl;
temp = a;
a = b;
b=temp;
int sum = a + b;
cout<<" after a = "<<a<<", b = "<<b<<endl;
cout<<" the sum is : "<<sum<<endl;
return 0;
}
👍1