Discuss Scratch
- Discussion Forums
- » Things I'm Making and Creating
- » C++ Official Topic
- SC_DStwo_Master
- Scratcher
100+ posts
C++ Official Topic
This is the official C++ topic! idk what else to say
Last edited by SC_DStwo_Master (Aug. 25, 2016 14:22:04)
- wolves4ever10
- Scratcher
100+ posts
C++ Official Topic
I used to try to learn c++, but then I sort of drifted away from it… Now I am learning C#. And making games in Unity right now.
- SC_DStwo_Master
- Scratcher
100+ posts
C++ Official Topic
If you want to make pc and ios (ipad and iphone) games, then there's this thing called stencyl. It is very similar to scratch but it costs. You can make your own 2d games for flash, ios, HTML5 and android with it. I used to try to learn c++, but then I sort of drifted away from it… Now I am learning C#. And making games in Unity right now.
- cobraguy
- Scratcher
1000+ posts
C++ Official Topic
I'm currently learning Java, but I really want to get into C++ or C# afterwards. What editor do you use for C++?
Last edited by cobraguy (Aug. 19, 2013 20:35:34)
- SC_DStwo_Master
- Scratcher
100+ posts
C++ Official Topic
Bah, just normal microsoft visual c++ 2010 I'm currently learning Java, but I really want to get into C++ or C# afterwards. What editor do you use for C++?
- mrf777
- Scratcher
63 posts
C++ Official Topic
im learning c right now (well acually in about in a few days)
- gdpr533f604550b2f20900645890
- Scratcher
1000+ posts
C++ Official Topic
Do not mix up C with C++, a separate language which is based on but is not C. im learning c right now (well acually in about in a few days)
- Chainmanner
- Scratcher
100+ posts
C++ Official Topic
I know a good amount of C++. What do you need it for?
- CatsUnited
- Scratcher
1000+ posts
C++ Official Topic
I want to try and learn C++. It's pretty hard though (but at least it has C syntax).
bottom text
- MegaApuTurkUltra
- Scratcher
1000+ posts
C++ Official Topic
^^^ I want to try and learn C++. It's pretty hard though (but at least it has C syntax).
Same here. It has some java and javascript like syntax, but I don't really understand pointers and casting and stuff…
$(".box-head")[0].textContent = "committing AT crimes since $whenever"
- Chainmanner
- Scratcher
100+ posts
C++ Official Topic
They're pretty simple.^^^ I want to try and learn C++. It's pretty hard though (but at least it has C syntax).
Same here. It has some java and javascript like syntax, but I don't really understand pointers and casting and stuff…
Pointers don't contain data themselves, but reference addresses in memory, and are created with the “new” syntax and freed with the “delete” syntax. So to create a pointer in C++, you would do
int* var1 = new int;
int* var2 = new int[666];
delete var1; delete var2[]
As for casting (explicit type conversion), it's basically converting variable types - it can be useful for trimming decimals off double variables by converting it into an integer, which would work as so:
double var1 = 6.66; int var2 = (int)var1;
You could also do this with classes. So say, for instance, you were modding the Source engine and needed to have your entity, class name CMyEnt, to be searched. You can't do
CMyEnt* myent = gEntList.FindEntityByClassname( "my_ent", NULL );
CMyEnt* myent = (CMyEnt *)gEntList.FindEntityByClassname( "my_ent", NULL );
Sorry if I'm bugging you with all this information, but I felt the need to help.
Last edited by Chainmanner (March 11, 2015 19:34:18)
- AnonymousMe
- Scratcher
50 posts
C++ Official Topic
Nice…int* var2 = new int[666];
Things I'm Working On / Going To Be Working On
AM_CPU
- MegaApuTurkUltra
- Scratcher
1000+ posts
C++ Official Topic
Cool, thanks.They're pretty simple.^^^ I want to try and learn C++. It's pretty hard though (but at least it has C syntax).
Same here. It has some java and javascript like syntax, but I don't really understand pointers and casting and stuff…
Pointers don't contain data themselves, but reference addresses in memory, and are created with the “new” syntax and freed with the “delete” syntax. So to create a pointer in C++, you would dofor an individual variable (integer for this case), andint* var1 = new int;for an array of integers containing 666 elements, and at the end you would doint* var2 = new int[666];to free up memory they used. They are much more dynamic than static variables.delete var1; delete var2[]
As for casting (explicit type conversion), it's basically converting variable types - it can be useful for trimming decimals off double variables by converting it into an integer, which would work as so:(which could be done implicitly, but I used this to demonstrate).double var1 = 6.66; int var2 = (int)var1;
You could also do this with classes. So say, for instance, you were modding the Source engine and needed to have your entity, class name CMyEnt, to be searched. You can't dobecause the aforementioned function returns a type of CBaseEntity*, not CMyEnt*. But what you could do is convert the result of the function to a type of CMyEnt*, because CMyEnt inherits from CBaseEntity:CMyEnt* myent = gEntList.FindEntityByClassname( "my_ent", NULL );CMyEnt* myent = (CMyEnt *)gEntList.FindEntityByClassname( "my_ent", NULL );
Sorry if I'm bugging you with all this information, but I felt the need to help.
When I said casting, I meant that I didn't understand these
reinterpret_cast const_cast static_cast dynamic_cast
Also, I feel like if I go into C++, I'll never get used to the style
void sample(Text t){ noscope(t); }
void Sample( Text t ) { Noscope( t ); }
And I also feel like I'm going to leave objects in memory all over the place without garbage collection…
Last edited by MegaApuTurkUltra (March 12, 2015 00:42:30)
$(".box-head")[0].textContent = "committing AT crimes since $whenever"
- Chainmanner
- Scratcher
100+ posts
C++ Official Topic
Cool, thanks.They're pretty simple.^^^ I want to try and learn C++. It's pretty hard though (but at least it has C syntax).
Same here. It has some java and javascript like syntax, but I don't really understand pointers and casting and stuff…
Pointers don't contain data themselves, but reference addresses in memory, and are created with the “new” syntax and freed with the “delete” syntax. So to create a pointer in C++, you would dofor an individual variable (integer for this case), andint* var1 = new int;for an array of integers containing 666 elements, and at the end you would doint* var2 = new int[666];to free up memory they used. They are much more dynamic than static variables.delete var1; delete var2[]
As for casting (explicit type conversion), it's basically converting variable types - it can be useful for trimming decimals off double variables by converting it into an integer, which would work as so:(which could be done implicitly, but I used this to demonstrate).double var1 = 6.66; int var2 = (int)var1;
You could also do this with classes. So say, for instance, you were modding the Source engine and needed to have your entity, class name CMyEnt, to be searched. You can't dobecause the aforementioned function returns a type of CBaseEntity*, not CMyEnt*. But what you could do is convert the result of the function to a type of CMyEnt*, because CMyEnt inherits from CBaseEntity:CMyEnt* myent = gEntList.FindEntityByClassname( "my_ent", NULL );CMyEnt* myent = (CMyEnt *)gEntList.FindEntityByClassname( "my_ent", NULL );
Sorry if I'm bugging you with all this information, but I felt the need to help.
When I said casting, I meant that I didn't understand theseI understand Java casting, which is basically what you explained. But what are these for?reinterpret_cast const_cast static_cast dynamic_cast
Also, I feel like if I go into C++, I'll never get used to the styleis so much neater thanvoid sample(Text t){ noscope(t); }void Sample( Text t ) { Noscope( t ); }
And I also feel like I'm going to leave objects in memory all over the place without garbage collection…
const_cast, static_cast, reinterpret_cast, and dynamic_cast are just like I mentioned above with type conversion. Not totally sure how they work, though, but I used dynamic_cast when modifying the Source engine to detect certain types of entities.
And, you can use pretty much whatever writing style you want. Both of those examples work in C++, but the language is strict on case-sensitivity.
Last edited by Chainmanner (March 13, 2015 20:04:42)
- christian2000
- Scratcher
50 posts
C++ Official Topic
I like C++. I have done a few simple things with it, but they are all console applications. If I want to make like a game or something with a GUI, I would use Java, just due to my laziness.
Last edited by christian2000 (March 13, 2015 02:09:49)
There used to be a meaningful signature here.
- gdpr533f604550b2f20900645890
- Scratcher
1000+ posts
C++ Official Topic
I am learning C++, and I am still a beginner.
I always need to check to see if I am supposed to use “<<” or “>>” for “cin” or “cout.”
I make many mistakes.
EDIT: Fixed a mistake. I had put the “return 0;” after the closing bracket, when it should have come before. I also changed the header file and used the std namespace. Also, code takes for the win!
//The most basic program.
#include <iostream>
int main ()
{
std::cout << "Hello World!/n" << std::endl;
return 0;
}
I always need to check to see if I am supposed to use “<<” or “>>” for “cin” or “cout.”
I make many mistakes.
EDIT: Fixed a mistake. I had put the “return 0;” after the closing bracket, when it should have come before. I also changed the header file and used the std namespace. Also, code takes for the win!
Last edited by gdpr533f604550b2f20900645890 (July 31, 2015 20:37:42)
- Chainmanner
- Scratcher
100+ posts
C++ Official Topic
I am learning C++, and I am still a beginner.
//The most basic program.
#include “std_lib_facilities.h”
int main ( )
{
cout << “Hello World!/n”;
}
return 0;
I always need to check to see if I am supposed to use “<<” or “>>” for “cin” or “cout.”
I make many mistakes.
“>>” is an insertion operator, so you use it with “cin” to get the user's input, and vice-versa for “cout”. Think of it in the sense that the arrows go from a data collector and point toward data storage.
- gdpr533f604550b2f20900645890
- Scratcher
1000+ posts
C++ Official Topic
Thanks, I'll try to use that to remember which operator is for “cin” and which operator is for “cout.”I am learning C++, and I am still a beginner.
//The most basic program.
#include “std_lib_facilities.h”
int main ( )
{
cout << “Hello World!/n”;
}
return 0;
I always need to check to see if I am supposed to use “<<” or “>>” for “cin” or “cout.”
I make many mistakes.
“>>” is an insertion operator, so you use it with “cin” to get the user's input, and vice-versa for “cout”. Think of it in the sense that the arrows go from a data collector and point toward data storage.
- selimi02
- Scratcher
70 posts
C++ Official Topic
I might as well toss my hat in here . Currently I'm working on an open source remake of Space Station 13 named… Space Station 14. Progress has been great. Right now we're redoing the grid system. Previously we used quadtrees which were fancy but not efficient. Our plan is to switch over to a grid system. I'm trying to figure out how many tiles an entity is in even though the entity is not perfectly in the squares. I think I figured out a solid way to do so but I'm still testing it out. If anyone is interested the can Google Space Station 14 and help us.
- Extremguy
- Scratcher
100+ posts
C++ Official Topic
C++ and C# are overrated
C for the Win !!!
(PS don't forget the semi colon
C for the Win !!!
(PS don't forget the semi colon
Extremguy le ptit tannant qui fait des gros petit projets avec Scratch depuis 2012.
Envie de créer tes propres jeux 2d a monde ouvert plus facilement. Viens utiliser dès maintenant mon projet!
- Discussion Forums
- » Things I'm Making and Creating
- » C++ Official Topic