Jump to content
منتدى البحرين اليوم

Recommended Posts

اكا هذي الحل

بس عدليه

مادري ليش يصير لي عاليمين

صاير شوي معتفس :n5:

اذا ما فهمتي له

بعدله

لأن الحين حاطته عالسررريع :de20:

 

 

#include<string>

#include<iostream>

using namespace std;

int main(){

string name1,name2,name3;

cout<<"Enter two names separated by a space: ";

cin>>name1;

cin>>name2;

cout<<"\nBefore the swap:\n";

cout<<"The first name is: ";

cout<<name1<<endl;

cout<<"The seconed name is: ";

cout<<name2<<endl;

cout<<"\nAfter the swap:"<<endl;

name3=name1, name1=name2, name2=name3;

cout<<"The first name is: ";

cout<<name1<<endl;

cout<<"The seconed name is: ";

cout<<name2<<endl;

return 0;

}

Link to comment
Share on other sites

اتفضل اخوي ماطلبت

 

#include<iostream>

#include<string>

using namespace std;

int main()

{

string name1, name2, name;

 

cin>>name1>>name2;

 

cout<<"first name"<<name1<<"\n2nd name"<<name2;

 

name=name1;

name1=name2;

name2=name;

 

cout<<"first name"<<name1<<"\n2nd name"<<name2;

 

return 0;

Edited by bo_jssom
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
الرد على هذا الموضوع...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...