C++ FUNCTIONS (2020) - What are generic functions and templates? PROGRAMMING TUTORIAL

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ก.ย. 2024
  • Generic programming is used to increase the efficiency of the code. The advantage of writing generic code is code reusability (which means that code that was written once can be used multiple times) and avoiding function overloading.
    In this video I'm explaining generic functions and templates.
    📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
    C++ Lambdas e-book - free download here: bit.ly/freeCpp...
    Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObj...
    🚀📈💻🔥 My Practical Programming Course: www.codebeauty...
    Experience the power of practical learning, gain career-ready skills, and start building real applications!
    This is a step-by-step course designed to take you from beginner to expert in no time!
    💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
    Use it quickly, because it will be available for a limited time.
    Download Visual Assist here: bit.ly/WT-CB
    I use it to enhance the performance, features, and support for C, C#, and C++ development in Visual Studio.
    Download Ultra Edit here: bit.ly/UE_CB
    It is a powerful, secure text editor designed specifically for programmers.
    ☕ If you've found my content helpful and would like to support me, you now have the option to buy me a coffee or a cookie! It's a small gesture of gratitude that means a lot to me and helps me keep creating free educational videos for you. You can use the link below to make a contribution: bit.ly/CodeBea...
    However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇
    Related videos:
    How to swap values of two variables - • How to swap values of ...
    Pass parameters by a reference - • C++ POINTERS (2020) - ...
    Function overloading - • C++ FUNCTIONS (2020) -...
    C++ Object-Oriented Programming Course - • C++ Object-Oriented Pr...
    Follow me on other platforms:
    Instagram 📸 - / truecodebeauty
    Twitter 🐦- / truecodebeauty

ความคิดเห็น • 141

  • @CodeBeauty
    @CodeBeauty  3 ปีที่แล้ว +31

    📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
    C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
    Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
    🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
    Experience the power of practical learning, gain career-ready skills, and start building real applications!
    This is a step-by-step course designed to take you from beginner to expert in no time!
    💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
    Use it quickly, because it will be available for a limited time.

    • @arifwidianto6344
      @arifwidianto6344 2 ปีที่แล้ว

      Wondering if we can swap an integer and a floating number in a single function with generics.. Do you know how to do that?

  • @madamadadane7989
    @madamadadane7989 2 ปีที่แล้ว +38

    I really wish you were our college professor 😭 you'd honestly save an entire class and help them pass instead of the professors we have that drive us to insanity and failure. i thank you from the bottom of my heart

    • @danieldian8708
      @danieldian8708 ปีที่แล้ว +1

      No their knownlege is so much when you reach to their level you would be acting like them so just learn to be your best

    • @hameedahmadzai9768
      @hameedahmadzai9768 9 หลายเดือนก่อน

      my college prof is shit Ingl

    • @roscko3142
      @roscko3142 6 หลายเดือนก่อน

      @@danieldian8708 NOPE. they are only professors because they are doing research, they really dont care if you dont understand them, thats how most computer science professors are. They are not trained to teach pretty ironic huh since their job is to teach

    • @1729krish
      @1729krish 5 หลายเดือนก่อน +4

      @@danieldian8708 True. But having great knowledge and being a great teacher are not necessarily correlated

  • @peri3138
    @peri3138 3 หลายเดือนก่อน +4

    I cant believe I did not know about this channel until now. Thank you for making high quality and easy to follow videos

    • @CodeBeauty
      @CodeBeauty  3 หลายเดือนก่อน

      Thank you for this comment, and welcome 🤗🥰

  • @StabbyMacStabStab
    @StabbyMacStabStab 3 ปีที่แล้ว +64

    If anyone is getting an error with this, it's probably because you named the "swap()" function in all lowercase. There is already a "swap()" function defined in the std library that you imported using the namespace so it will cause an ambiguous function overload error.

    • @Kanha0321
      @Kanha0321 3 ปีที่แล้ว +18

      thank you so much for this comment. With this 4 lines only you'd explained why using namespace std is a bad practice.

    • @sanalkumara1594
      @sanalkumara1594 2 ปีที่แล้ว

      Thankyou

    • @salahruziev732
      @salahruziev732 2 ปีที่แล้ว

      Thank you ❤

    • @niloym4054
      @niloym4054 2 ปีที่แล้ว

      thanks a lot

    • @navjotsingh2251
      @navjotsingh2251 2 ปีที่แล้ว +2

      @@Kanha0321 nothing wrong with it, you just need to name your functions uniquely, so that you don't clash with std. I've not had any problems, just had to name my functions following a pattern so that there are not any clashes.

  • @lukaskocman7546
    @lukaskocman7546 3 ปีที่แล้ว +24

    One of the best c++ tutorials on youtube. You amazing explain!

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +2

      Thanks ☺️🥰

  • @renefuller9241
    @renefuller9241 ปีที่แล้ว +2

    One of the best and easiest definition of references ever! Dry, to the point. No fluff.

  • @legolas5684
    @legolas5684 3 ปีที่แล้ว +15

    10k coming faster than the speed of light! Great Content as always!

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +7

      Thank you so much! Big support as always! 💕

    • @bigtymer4862
      @bigtymer4862 2 ปีที่แล้ว +1

      About to pass 170k now!! Super awesome!!

  • @Daniel-cl6hj
    @Daniel-cl6hj 3 ปีที่แล้ว +26

    I just ran into an issue on this one where I defined my swap function with all lowercase (since functions are camel case and classes are camel starting with an upper, so I thought you made a mistake). Turns out there's a built in swap function that's already generic (and it was getting called without prepending std:: since I included the std namespace globally). So when I used the generic type in my function definition it thought I was overloading it to be generic AGAIN so it had no clue which one to use... Interesting little bug that sent me down a rabbit hole lol

  • @khalidben9940
    @khalidben9940 3 ปีที่แล้ว +3

    as a software engineer who has learnt C++ before I found your explanation amazing.Keep it up.

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      Thank you so much for the support! 🥰🤗

  • @fatima-wb7dh
    @fatima-wb7dh 3 ปีที่แล้ว +4

    I am a first year student at ITE university and i have just found your tutorial for c++ programming 😮it's amaizing and the best i swear💘 we are so lucky to have you miss 🥺🥺
    Keep going😍❤️❤️

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +2

      Fatima, that is awesome! I'm so happy that my videos can help 🤗🥳

    • @fatima-wb7dh
      @fatima-wb7dh 3 ปีที่แล้ว +1

      @@CodeBeauty yesss, it helps alot🥺🥺❤️❤️👍and i hope if we can have a java course by you🙏💘 we will be so thankful😍❤️❤️

  • @sergiorome48
    @sergiorome48 6 หลายเดือนก่อน

    you are the best programming TH-cam instructor, no one compares to your tutorials in both explanation of theory, along with easy to follow, concise and explicit tutorials.

  • @amyyy43
    @amyyy43 3 หลายเดือนก่อน +1

    best channel to learn programming for slow learner like me🤩

    • @CodeBeauty
      @CodeBeauty  3 หลายเดือนก่อน +1

      I'm happy that even the videos I made 4 years ago still help. If you want to learn practical programming and get skills that you need to start a career, then you can get my course and mentorship here:
      www.codebeautyacademy.com

  • @dieumercimbo9304
    @dieumercimbo9304 ปีที่แล้ว +1

    Thank you so much for your clear and precise explanation than the book. You are currently holding the medal for C++ tutorials.

  • @learnfromatharv7121
    @learnfromatharv7121 2 ปีที่แล้ว +2

    You are so crisp in your explanations and presentation that I feel yours are one of the best c++ tutorials on TH-cam. I would recommend these videos to everyone. Will you please make some videos on software architecture for budding coders. What I mean, how should one start developing a software/application and organize his/her code?

  • @jeetenzhurlollz8387
    @jeetenzhurlollz8387 5 หลายเดือนก่อน +1

    Einstein quote: “If you can't explain it simply, you don't understand it well enough.”...you make it all so simple Saldana....

    • @CodeBeauty
      @CodeBeauty  5 หลายเดือนก่อน

      Thank you 🥰

  • @iffy1533
    @iffy1533 3 ปีที่แล้ว +2

    Best codes explaination method on yt .. 💯 thanks saldina 💕

  • @fglatzel
    @fglatzel ปีที่แล้ว

    Generic programming using templates is one of those great features in modern C++
    and you explain this in a very easy to follow way. Thank you, CodeBeauty.

  • @marselnaidenov725
    @marselnaidenov725 2 ปีที่แล้ว +1

    You deserve more subscribers. Thank you so much

  • @egyptianst0rm334
    @egyptianst0rm334 2 ปีที่แล้ว

    So many people cannot explain this subject well and you make it look like a child's play toy.
    thank you

  • @aswinmanmathans6837
    @aswinmanmathans6837 2 ปีที่แล้ว +1

    you reallly killed my 8 days of research , in just 10 min

  • @roukayaroukaya5289
    @roukayaroukaya5289 3 ปีที่แล้ว +1

    omg code beauty i'm really surprised by you're explain it made me finished your course of function only in 3 days 😍😍😍thank u so much beauty and now i'm gonna to oop course

  • @TheodorusAtheist-sx1un
    @TheodorusAtheist-sx1un 3 หลายเดือนก่อน

    It's been three years. Is this amazing girl still alive?

  • @patrickmayer9218
    @patrickmayer9218 2 ปีที่แล้ว

    *Generics are a way to make functions that work for different variable types.
    * put "template" (or any other name for your template) in the line above your function, and use that name as the type of the variables in the function.
    *Although it is not required, it is best practice to specify the type of variables when you call the function. For example, instead of
    Swap(a, b);
    You should do
    Swap(a, b);
    Thank you for the video, Saldina!

  • @CostlyFiddle
    @CostlyFiddle 2 ปีที่แล้ว

    Phenomenal video, this is the first of your videos I have watched. I returned to university to fulfill my life dream of combining my love in computers & physics. My dual major currently is Computer Science & Physics, this video is invaluable & really helped me understand the concept. I will be watching more of your videos and maybe gain a slight advantage over my far younger peers (I'm twice the age of many of my classmates). Thanks again and welcome to my algorithm!

  • @bhaddiyatanchangya520
    @bhaddiyatanchangya520 3 ปีที่แล้ว +2

    Many, many thanks CodeBeauty for your wonderful tutorials! You make the most difficult C++ extremely easy to understand. I just love your tutorials. I think by following your tutorials even a baby can code in a most difficult language as the C++ can be just like a pro.

  • @emmanuelsharp7031
    @emmanuelsharp7031 10 หลายเดือนก่อน

    Your videos are just way too in-depth and very well explained. you're like a goddess of code explanation... please I'm not sure if you stopped making videos, but don't stop... create more videos to help the world of students.

  • @murtazaali9346
    @murtazaali9346 2 ปีที่แล้ว +1

    I love to watch your videos . You're awesome .

  • @cranixstein6207
    @cranixstein6207 2 ปีที่แล้ว +1

    Thank you very much Saldana, love you

  • @MrBPeet
    @MrBPeet 3 ปีที่แล้ว +1

    I started learning C/C++ 3 years ago based on several other tutorials and i can say your tutorials are so much better that i can not help watching them all even though i already know most things you explain...which is pretty amazing i think!
    Speaking about functions, maybe you could also insert a video about callback functions in this playlist.

  • @shahzaibkhan8971
    @shahzaibkhan8971 3 ปีที่แล้ว +3

    I always learn something new from your videos. Amazing content as always 🔥

  • @vk2ig
    @vk2ig 3 ปีที่แล้ว

    I got through all of your six videos on Functions tonight - thanks very much posting them! And I learnt something which I'd never covered before, viz. generics and templates - again, thank you!

  • @tradethecash
    @tradethecash 3 ปีที่แล้ว +2

    Thank you so much for your work. I understand perfectly what you said in yours videos. I like your style as you explain the different parts from IT. I am glat to hear your , see you and learnt from you. So move on , smile, have a beautiful day and thank you again. ^-^

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว

      Thank you. I wish you a beautiful day too 💟

  • @breakdancerQ
    @breakdancerQ 4 หลายเดือนก่อน

    clear and easy... how it should be

  • @marioskasolas9210
    @marioskasolas9210 ปีที่แล้ว

    this explanation is just simple and clean perfect!

  • @mikamusic5679
    @mikamusic5679 3 ปีที่แล้ว +3

    thanks saldina that was really helpful and well explained :)

  • @voferreira
    @voferreira 2 ปีที่แล้ว

    Easiest explanation I found. Thank you very much!

  • @HeadRecieverAtHeadOffice
    @HeadRecieverAtHeadOffice 2 ปีที่แล้ว

    Every explanation was phrased perfectly, thank you

  • @anxonpues6018
    @anxonpues6018 9 หลายเดือนก่อน

    Muy muy bueno, se entiende, los ejemplos son de claridad absoluta y sencillos. 10/10!!

  • @zonaedahmed1819
    @zonaedahmed1819 2 ปีที่แล้ว +1

    can you please make more vedios on c++ templates deeply please. as its a important concept for competitive programming..thank you

  • @sthembisomsimango
    @sthembisomsimango หลายเดือนก่อน

    I love you, you make it seems easy❤❤

  • @alexandrachyu
    @alexandrachyu 2 ปีที่แล้ว +2

    Hi, can you please do a video about "template within a template?" Something like this: template , I've always had trouble reading and understanding it. Thanks~

  • @ChrisVideosGreek
    @ChrisVideosGreek 3 ปีที่แล้ว +1

    You are so close to reach 100k subs!!!!!!!

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      I am 🥳🥳🥰

  • @bodnarsa
    @bodnarsa 3 ปีที่แล้ว +1

    Hi Saldina! You created excellent C++ videos but no UTF-8 string handling. Please make one.

  • @zombiehellmonkeygaming1956
    @zombiehellmonkeygaming1956 3 ปีที่แล้ว +1

    Thanks, best explanation for templates I've found !

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      Thank you! 🥰🤗

  • @sv3glx
    @sv3glx 3 ปีที่แล้ว +1

    I must thank you very-very much! Great explanation and really helpful! Keep going on.

  • @WebSculptors
    @WebSculptors ปีที่แล้ว +1

    so goood thank you

  • @Saimali-wg1bv
    @Saimali-wg1bv 3 ปีที่แล้ว

    A really good & clear explanation, thankyou !.

  • @fernandoalbuquerque6645
    @fernandoalbuquerque6645 3 ปีที่แล้ว +1

    You're really, really good !!!

  • @temirkhanamanbaev42
    @temirkhanamanbaev42 2 ปีที่แล้ว

    Incredible easy explai, thanks a lot.

  • @Kenforbes3
    @Kenforbes3 ปีที่แล้ว +1

    Thanks!

    • @CodeBeauty
      @CodeBeauty  ปีที่แล้ว

      Thank you again 🤗🥰

  • @toastyren3991
    @toastyren3991 3 ปีที่แล้ว

    Another amazing video :-) Thank you so much once again Saldina ! :-)

  • @mujahidmustafa7903
    @mujahidmustafa7903 2 ปีที่แล้ว

    O M G...Mind Blowing ...😇

  • @immortalbotyt1428
    @immortalbotyt1428 2 ปีที่แล้ว

    Hey this generics is really useful If I knewabout it before it'd be cool but no more tension you taught me :)

  • @jolly_dollyyy
    @jolly_dollyyy 2 ปีที่แล้ว

    lucid explanation!!

  • @pg.idrees
    @pg.idrees 2 ปีที่แล้ว

    amazing video , thanks

  • @MrSofianeDz01
    @MrSofianeDz01 3 ปีที่แล้ว +1

    excellent explanation, please i have a problem and i don't know how to do it, and it would be a great idea for a video ! if you can help !

  • @douglascunha3238
    @douglascunha3238 3 ปีที่แล้ว

    Excelente tutorial, muitíssimo obrigado.

  • @rnd1sir347
    @rnd1sir347 2 ปีที่แล้ว

    you are so good.

  • @voneverk
    @voneverk 11 หลายเดือนก่อน

    thx that was helpful👍

  • @alejandroperez5368
    @alejandroperez5368 ปีที่แล้ว

    Good explanations. But you didn't explain why the Swap function has the addresses of a and b as the parameters. Why aren't those parameters pointers like in the Pass parameters by a reference video?

  • @oleksisfraga
    @oleksisfraga 3 ปีที่แล้ว +1

    Thanks for the content and your time. You think we get the point to see topics about Threads/Process/Concurrent programming in C++ ? Thanks one more time 🙏🏾

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว

      Yes, I'll work on those videos in the future ☺️

  • @subee128
    @subee128 2 ปีที่แล้ว

    Thanks

  • @lofto8363
    @lofto8363 2 ปีที่แล้ว +1

    Спасибо за урок)

  • @jacquesduplessis3284
    @jacquesduplessis3284 3 ปีที่แล้ว

    Just a note that case matters in the name 'Swap', because 'swap' is already included (somewhere)...

  • @harikrishnanb7273
    @harikrishnanb7273 2 ปีที่แล้ว

    can you make a video about class templates !!

  • @ahmadahmad-ug8ls
    @ahmadahmad-ug8ls 4 หลายเดือนก่อน

    the best istg

  • @nastaranheidarysharifabadi4648
    @nastaranheidarysharifabadi4648 ปีที่แล้ว

    thanku

  • @starthustling3290
    @starthustling3290 2 ปีที่แล้ว

    thanks :)

  • @terryalleyne8455
    @terryalleyne8455 ปีที่แล้ว

    how do I write the code for separate files cpp, .hand main.cpp?

  • @marco21274
    @marco21274 3 ปีที่แล้ว

    I think with C++ 20 you can now use auto: void swap(auto &l, auto &r).

  • @ladymorwendaebrethil-feani4031
    @ladymorwendaebrethil-feani4031 2 ปีที่แล้ว

    I would like to know if there is any way to use a generic type input in c++. Something that allows me instead of passing the value by argument (using function overloading or templates), simply capturing an generic input from the keyboard.

  • @divanbasson5545
    @divanbasson5545 2 ปีที่แล้ว +2

    For the youtube algorithm.

    • @CodeBeauty
      @CodeBeauty  2 ปีที่แล้ว

      Thank you! ❤️❤️

  • @John_Wall
    @John_Wall ปีที่แล้ว

    Hi Saldana - following your advice for best practice I moved the Swap() definition below main(), and placed a Swap() declaration above main(). However, things started going a bit pear-shaped when it came to adding template. Unless I place the template line immediately above both the Swap() definition and declaration I get a compiler error. But the solution feels wrong as I am duplicating the same line of code. Is it correct to write the template line twice, or is there a better way? Cheers. P.s There seem to be many very clever people teaching coding on YT, but imo you have by far the best teaching style - you always break the problems down into easy to understand chunks, so thank you!

  • @jones_17
    @jones_17 3 ปีที่แล้ว

    Please teach operator overloading

  • @simpleboy8556
    @simpleboy8556 3 ปีที่แล้ว

    Hello. I have some question for you.Why do you choose C++, not C# or Phython

  • @arsalan4510
    @arsalan4510 2 ปีที่แล้ว

    did u make those in-depth videos for templetes

  • @RIMANITIN
    @RIMANITIN 3 ปีที่แล้ว

    Mam, Is it possible to perform multiple functions using the same to template example I can add, subtract, multiplication, divide only in one template. I'm in trouble. Please help me or anyone can else🙏🙏

  • @spytonic4171
    @spytonic4171 3 ปีที่แล้ว

    can you plz make a video on c++ stl?

  • @moisesnapoles2153
    @moisesnapoles2153 3 ปีที่แล้ว +1

    Hi, just making sure, I cannot use the same template for multiple functions right? I always have to create a template for each individual function?

    • @joaops4165
      @joaops4165 3 ปีที่แล้ว +1

      Sorry for the English.
      I think the (template ) is part of the function declaration.
      I tried to use declaration and definition, and I only managed to do it like this:
      #include
      using namespace std;
      template void Swap(T& a, T& b);
      int main() {
      int a = 10, b = 20;
      cout

    • @moisesnapoles2153
      @moisesnapoles2153 3 ปีที่แล้ว +1

      @@joaops4165 thanks! 😁

  • @zhibindeng8723
    @zhibindeng8723 ปีที่แล้ว

    how to automatically format your code by just press an enter?

  • @sarvarqosimov8363
    @sarvarqosimov8363 2 ปีที่แล้ว +1

    👍

  • @bearsoundzMusic
    @bearsoundzMusic 3 ปีที่แล้ว

    The function swap is only partly generic imo
    It swaps two *int* variables or *two* char variables
    Real generic would have to be able to handle _more_ than *one* type, in the _same_ call
    So
    int main(){
    int a=5;
    char b = 'b';
    cout

    • @yxlxfxf
      @yxlxfxf 2 ปีที่แล้ว

      dunno if you still need the answer but yes, it is possible. Just declare two template parameters:
      template
      void swap(T &&a, U &&b);

  • @WistrelChianti
    @WistrelChianti 3 ปีที่แล้ว +1

    oooooooooooooooooh - I'm kinda disappointed that that's all they are... I was expecting some sort of Archean Dark Voodoo

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว

      Hahaha, nope
      They're pretty simple 😊😊

  • @73dines
    @73dines 3 ปีที่แล้ว +1

    Neobicno bez naocala :)

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      Hahaha 😅
      Uglavnom ako sam citav dan provela radeci na racunaru pa onda uzmem da snimam, oci mi budu umorne i moram nositi cvike 🤓
      A ako sam odmarala od ekrana taj dan, onda mogu i bez njih 😋

  • @yixingshen6286
    @yixingshen6286 3 ปีที่แล้ว

    can you explain the function type of void?

  • @blueli9ht101
    @blueli9ht101 3 ปีที่แล้ว +1

    i love u

  • @FlyingTurtleLP
    @FlyingTurtleLP 3 ปีที่แล้ว

    6:20 Vid starts here if you know at least a little bit of c ;)

  • @tarearnaut3502
    @tarearnaut3502 3 ปีที่แล้ว

    You dont have a tutorial for arrays?

  • @zed_business519
    @zed_business519 7 หลายเดือนก่อน

    #include
    using namespace std;
    int factorial(int num) { // Renamed for clarity
    if (num == 0) {
    return 1; // Base case for 0!
    } else {
    return num * factorial(num - 1); // Recursive call
    }
    }
    int main() {
    int num;
    cout > num;
    if (num >= 0) {
    cout

  • @leratomakola1951
    @leratomakola1951 2 ปีที่แล้ว

    💜💜💜💜💜💜

  • @log8746
    @log8746 3 ปีที่แล้ว

    We pass arguments*

  • @shonhazan5065
    @shonhazan5065 3 ปีที่แล้ว +1

    i want your voice to be my siri

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว

      Hahaha, that is funny 😅😁🤗

  • @charan2446
    @charan2446 3 ปีที่แล้ว

    DARK MODE!!!!!!!!!

  • @rustedshader
    @rustedshader 3 ปีที่แล้ว

    you also watch Bucky's tutorial na lmao xD.

  • @AndrewOBannon
    @AndrewOBannon 3 ปีที่แล้ว +1

    merry me

  • @adulladahalrifat8173
    @adulladahalrifat8173 3 ปีที่แล้ว

  • @dogarunicolaeemil9997
    @dogarunicolaeemil9997 2 ปีที่แล้ว

    #include
    using namespace std;
    template
    void change (E &a, E &b){
    E temp;
    temp=a;
    a=b;
    b=temp;
    }
    int main()
    {
    int x=7, y=47, z;
    change(x,y);
    cout

  • @frodobaggins3974
    @frodobaggins3974 2 ปีที่แล้ว

    ...or you can just use Python :)