Monday, December 19, 2022

I asked ChatGPT to write a childrens story about coding in C, C++ and Ada

Quite cute, I would say :D


Chapter 1: C

Once upon a time, there was a nerdy girl named Sophie who loved to play with computers. She was always curious about how they worked, and she loved to tinker with the different software programs on her computer.

One day, Sophie's mom told her about a new programming language called C. It was a powerful language that was used to create all sorts of computer programs, from video games to scientific simulations. Sophie was very excited to learn more about C, and she asked her mom to help her get started.

Her mom suggested that they start by installing a C compiler on their computer. This would allow Sophie to write and run C programs from the comfort of her own home. Sophie was thrilled at the prospect of creating her own programs, and she eagerly set to work installing the compiler.

Once the compiler was installed, Sophie's mom showed her how to write a simple "Hello, World!" program in C. Sophie typed out the code and ran the program, and to her delight, the computer printed out "Hello, World!" on the screen.

Sophie was hooked on programming in C, and she spent every free moment tinkering with her computer and learning more about the language. She was determined to become a master programmer, and she knew that with practice and hard work, she could accomplish anything.

And so, Sophie's journey as a programmer began. She was excited to see where her new skills would take her, and she knew that with a little bit of nerdy determination, she could accomplish anything she set her mind to.


Chapter 2: Variables, booleans and pointers

As Sophie continued to learn more about programming in C, she learned about something called "variables." These were like little containers that could hold different pieces of information, like numbers or words. Sophie could use variables to store data and use it in her programs.

One day, Sophie's mom asked her to write a program that would calculate the average of a list of numbers. Sophie was excited to try, and she set to work writing her code. She used variables to store each number in the list, and then she added them all up and divided the sum by the number of numbers in the list. When she ran the program, it worked perfectly! Sophie was thrilled with her success.

Next, Sophie learned about something called "booleans." These were special variables that could only hold two values: "true" or "false." Sophie learned that she could use booleans to make decisions in her programs. For example, she could use a boolean to check if a number was even or odd. If the number was even, the boolean would be "true," and if the number was odd, the boolean would be "false." Sophie had a lot of fun playing around with booleans and using them to make her programs smarter.

Finally, Sophie learned about something called "pointers." These were special variables that could "point" to other variables in a program. Sophie learned that she could use pointers to access and modify variables from different parts of her code. It was a bit tricky to understand at first, but once Sophie got the hang of it, she found that pointers were a really powerful tool for programming in C.

Sophie was having a great time learning about programming in C, and she was excited to see where her new skills would take her. She knew that with a little bit of practice and a lot of nerdy determination, she could accomplish anything she set her mind to.

Chapter 3: C++ and princesses

As Sophie continued to learn more about programming in C, she discovered something called C++. It was a more advanced programming language that added even more powerful features to the C language. Sophie was excited to learn more about C++, and she spent every free moment tinkering with her computer and learning as much as she could.

One of the most interesting things about C++ was something called "object-oriented programming." This was a way of writing programs that used "objects" to represent real-world things. Each object could have different "features" or "attributes," like a person's name or a car's color. Sophie thought this was really cool, and she decided to use Disney princesses as her first objects.

Sophie created a "Princess" object, and she gave it features like a name, a age, and a favorite color. She then created objects for each of her favorite princesses, like Ariel, Belle, and Cinderella. Each princess object had its own set of features, like Ariel's love of the ocean or Cinderella's glass slippers. Sophie had a lot of fun playing around with her princess objects and seeing how they interacted with each other.

As Sophie continued to learn more about C++ and object-oriented programming, she found that she was able to create more and more complex programs. She was thrilled with her progress, and she knew that with a little bit of practice and a lot of nerdy determination, she could accomplish anything she set her mind to.

Chapter 4: Discovering Ada

As Sophie's love for programming grew, she started to explore more and more languages. One day, she discovered a language called Ada. Ada was a powerful, high-level language that was used to create all sorts of programs, from video games to scientific simulations. Sophie was immediately intrigued by Ada, and she set to work learning as much as she could.

One of the things that Sophie loved most about Ada was its emphasis on safety and reliability. Ada was designed to be very strict and precise, which made it great for creating programs that needed to be absolutely rock-solid. Sophie was impressed by the level of care and attention that went into the design of Ada, and she knew that it was a language that she could really sink her teeth into.

As Sophie continued to learn more about Ada, she found that she really enjoyed working with it. The syntax was clear and concise, and she found that she could write programs much more quickly and easily in Ada than she could in some of the other languages she had tried.

Sophie still loved C and C++, but she found that Ada offered a fresh new perspective on programming. She was excited to see where her new skills would take her, and she knew that with a little bit of nerdy determination, she could accomplish anything she set her mind to.