سلسة : C++ VS PYTHON المشكلة الاولي

                               //by c++


Copyright© 2022 PROGRAMMING ADVICE Mohammed Abu-Hadhoud//
#include
#include
//Problem #1
//Write a program to print your name on screen.
using namespace std;
//steps to solve the problem
//1. Start
//2.read the input from the user
//3. print the input
//4. End

//tools to solve the problem
//1.procedure to print the input
//2.function to exit the program
//3.function to clean screen

//slove the problem :
//1.procedure to print the input
void print_name(string name)
{
cout <<“your name is :” << name << endl;
}

//2.function to exit the program
int exit_program()
{
cout << “Exit the program” << endl;
cin.ignore();
cin.get();
return 0;
}
;
//3.function to clean screen
int clean_screen()
{if (system(“CLS”)) system(“clear”);
return 0;
}
;
// main function
int main()
{
string name;
print_name(“adel”);
exit_program();
clean_screen();
return 0;
}
by python :slight_smile:
#Copyright© 2022 Mohammed Abu-Hadhoud

#Problem #1

#Write a program to print your name on screen.

#Use a function to print your name.

def name(user_name):

print(f"Your name is: {user_name} \n")

name(“Adel ahmed”)

#ANOTHER WAY (“without using function”)

print(“Your name is: Adel ahmed”)

إعجاب واحد (1)