sdifox
No Lifer
- Sep 30, 2005
- 97,977
- 16,739
- 126
You ask ChatGPT to teach you C++Is there a app like chatgpt that runs on C++?
Google says chatgpt runs on Python, I'm trying to learn C++ because it's the language most video games use.
You ask ChatGPT to teach you C++Is there a app like chatgpt that runs on C++?
Google says chatgpt runs on Python, I'm trying to learn C++ because it's the language most video games use.
You ask ChatGPT to teach you C++
I don't want to just "LEARN" C++, I want to "USE" it.
I would rather use a program that runs on C++.
I'm a little confused, Wikipedia says that Facebook, YouTube, and Windows 11 all run on C++.WTF
Nothing runs on C++.
No. They were written in C++, then compiled to machine code. That is what makes it faster. Python is interpreted just in time so there is more overhead. Of course, you can also compile Python to machine code.I'm a little confused, Wikipedia says that Facebook, YouTube, and Windows 11 all run on C++.
Also alot of video game engines runs on C++ such as unreal engine.
Is there a app like chatgpt that runs on C++?
Google says chatgpt runs on Python, I'm trying to learn C++ because it's the language most video games use.
I don't want to just "LEARN" C++, I want to "USE" it.
I would rather use a program that runs on C++.
I'm a little confused, Wikipedia says that Facebook, YouTube, and Windows 11 all run on C++.
Also alot of video game engines runs on C++ such as unreal engine.
First of all, C++ is not a beginner friendly language.I don't want to just "LEARN" C++, I want to "USE" it.
I would rather use a program that runs on C++.
First of all, C++ is not a beginner friendly language.
Two people can say "I know C++". One could be a person who has compiled a "Hello World" C++ program and the other could be Bjarne Stroustrup (the actual inventor of C++).
A very proficient sysadmin (rachelbythebay.com) with intermediate (and maybe advanced) C language capabilities hated C++, until someone with C++ expertise showed her how to write C++ code that uses C++'s strengths rather than using it superficially and now she actually likes C++. That should tell you that C++ is not for the faint of heart.
If you seriously want to do game programming, start here: https://github.com/poyea/scrabble
First step: Install Visual Studio
2nd step: Install Git
3rd step: Clone that repo
4th step: Double click the Scrabble.sln and then "Build" it using Visual Studio. Once that is finished, you will find an EXE file in the repo folder. Double click it and that's the game.
Now open the source file of that game and tinker with it. Try to recognize familiar things in it (like colors or number of rows and columns in the board etc.) and tinker with the values and see how that changes the game. There might be useful comments in the source file. Otherwise, copy any code snippet you want to understand and give it to ChatGPT to explain it to you.
Once you have thoroughly understood everything, try writing your own version of this game on your own. It will take a long time. But once you succeed, you will finally have the confidence to pursue harder stuff.
That's true for a huge number of people with CS degrees. If you start with procedural programming, you are kinda screwed in making sense of OOP concepts. That's why I've seen CS curriculums where they start teaching directly with Java (but that has its own issues). But at least with Java as a starting point, you can apply your OOP concepts better in C++.I suspect I was just writing old school procedural programs using C++ syntax.
An LLM trained to do those things could do 80% of the heavy liftingGames are hard, not only from a coding perspective but an artistic one. You have to design all the textures, 3D models, sounds, music etc...
That's true for a huge number of people with CS degrees. If you start with procedural programming, you are kinda screwed in making sense of OOP concepts. That's why I've seen CS curriculums where they start teaching directly with Java (but that has its own issues). But at least with Java as a starting point, you can apply your OOP concepts better in C++.
A good starting point is the "principles" book by the C++ inventor: https://www.stroustrup.com
Have a look, thanks to ChatGPT:Felt like my brain had reached its limits at that point.
Converting a float to a string can be done in both C and C++, but the approaches differ in terms of complexity, safety, and convenience. Below, I will show you how to perform this conversion in both languages and then explain why the C++ approach is often considered better, particularly from an Object-Oriented Programming (OOP) perspective.
C Code Example
In C, you can convert a float to a string using the sprintf function or snprintf for safer string manipulation. Here's an example using snprintf:
#include <stdio.h>
int main() {
float number = 123.456;
char buffer[50];
// Convert float to string
snprintf(buffer, sizeof(buffer), "%.2f", number);
// Print the result
printf("The float as a string is: %s
", buffer);
return 0;
}
C++ Code Example
In C++, you can utilize the std::to_string function from the <string> header or use a std::ostringstream object for more control. Here's an example using std::to_string:
#include <iostream>
#include <string>
int main() {
float number = 123.456;
// Convert float to string
std::string strNumber = std::to_string(number);
// Print the result
std::cout << "The float as a string is: " << strNumber << std::endl;
return 0;
}
Comparison and OOP Advantages of C++
Ease of Use:
In C++, using std::to_string is straightforward and requires less boilerplate code compared to C's sprintf or snprintf. This ease of use makes the code cleaner and less error-prone.
Type Safety:
C++ provides better type safety through its standard library. The std::to_string function directly takes a float and returns a string, reducing the risk of buffer overflows or format string vulnerabilities that can occur in C.
Object-Oriented Features:
C++ supports OOP principles, allowing you to encapsulate related functionalities into classes. For example, you could create a class that represents a numeric value and includes methods for formatting it as a string. This encapsulation makes the code more modular and reusable.
Here’s a simple class that demonstrates this idea:
#include <iostream>
#include <string>
#include <iomanip>
#include <sstream>
class FloatConverter {
public:
FloatConverter(float num) : number(num) {}
std::string toString(int precision = 2) const {
std::ostringstream oss;
oss << std::fixed << std::setprecision(precision) << number;
return oss.str();
}
private:
float number;
};
int main() {
FloatConverter converter(123.456);
std::cout << "The float as a string is: " << converter.toString(2) << std::endl;
return 0;
}
In this example:
The FloatConverter class encapsulates the float value and provides a method for converting it to a string with a specified precision.
This makes the conversion reusable and allows for future extensions (e.g., more formatting options) without changing the interface.
Standard Library and Flexibility:
C++ has a rich standard library that provides many utilities for string handling, making it easier to manipulate and format strings compared to C.
In summary, while C can efficiently convert floats to strings, C++ provides a more robust, safer, and easier-to-use mechanism that benefits from OOP principles and the rich standard library, leading to more maintainable and flexible code.
Anyone know's if you could use ChatGPT on the Nintendo Switch?
I tried googling it but i didn't get an answer.
I never had a Nintendo Switch, can you download apps like you can on a smartphone?
That's true for a huge number of people with CS degrees. If you start with procedural programming, you are kinda screwed in making sense of OOP concepts. That's why I've seen CS curriculums where they start teaching directly with Java (but that has its own issues). But at least with Java as a starting point, you can apply your OOP concepts better in C++.
A good starting point is the "principles" book by the C++ inventor: https://www.stroustrup.com
I learnt Java from James Gosling. Not that I retained the lecture or anythingI took an Advanced C++ class in college like twenty years ago & bought the books that summer. I couldn't figure anything out ahead of time, so I emailed the author and he said yeah it's kind of difficult, definitely take the class. Turns out it was Stroustrup LOL. I was like uhhh can I also interview you for my class hahaha. Super cool guy! I failed the class & had to retake it FYI
Twitter did the same thing in terms of connecting to people doing cool stuff...everyone from the pfSense guys to John Carmack (Doom) were on there all the time back in the day!
Python calls highly optimised gpu specific routines written in C/C++ to accelerate the AI task. Python is just used as a simple scripting language initiating operations and passing references to and from various data structures to be operated on.I'm surprised ChatGPT is actually coded in python. Seems C++ would be more optimized for that sort of thing.