AI would be a pain in the ass to do, anyway.
I’m using windows platform code to clear the console so,
Na. Probably take a few hours.
The trick would be getting it to find a position fast enough.
buy a better pc
I once said such a thing to my computer algorithms professor a few semesters ago only to have him shake his head and laugh.
So I do the same to you.
Although thats great, it seems beyond my scope, and i don’t understand it really, although i’m gonna study it
I JUST started, so looking at these is hurting my head.
Not sure why people whine about learning C++ who previously learn’t in java, basic concepts in programming appear to remain the same, just different syntax
Except in java you do not have to worry about memory management or pointers.
Except in java you still have null pointer exception, and you have to worry about memory management (Minecraft taking 1gb, srsly, wth?), and of course you cannot use built-in types as template arguments, which sucks big time.
You misunderstood. In C++ you have to control your memory manually. Java automatically throws out old variables, etc. Java code uses as little memory as feasible. With C++, you have to take those precautions and steps manually (garbage collection).
https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Availability
Even though you can get a null pointer exception in Java, you aren’t actually using pointers.
Java doesn’t throw out old variables, only unreferenced ones. That’s why you still have to worry about memory management. If you don’t, you get Minecraft.
Once again: garbage collection is only a subset of memory management.
You still have to worry about memory management when it’s becoming a problem (ie, you have 300 circular references after you’re program’s been running for a while) The easiness is that you don’t have to think so much about memory until then, and it’s usually somewhat easy to fix.
WARNING: C++ rant ahead!
I’ve been kind of hoping that the industry could start to move away from C++ development. Even after learning programming for 5+ years in school, it baffles me with all its typedefs and macros. Simple things like string conversion take hours of Google research. Honestly, when I’m programming a game I want to get it DONE, not cleanly code out individual H/CPP files and design my own methods for everything. The only problem is, C++ is currently the only way to go for making a native-built, highly efficient program. I kind of wish things would move on to another, simpler language, be it D or even Google’s Go.
You can imagine I drooled when Unity3D said it supported native C# code.
If C++ were to have more native support for multi-platform code (i.e. no need to worry about different type sizes on different platforms), and weren’t so problematic with all the different types of strings, it would be a much better choice for developing stuff.
Right now, you have to program your own system for managing languages since the standard library isn’t sufficient for that. Some people might consider that good, since the system you make is going to be purpose built for your program, but it’s like reinventing the wheel, in the end, it only wastes time.
This essay has some pretty hilarious jokes about people writing bad code, in various languages.
https://mindprod.com/jgloss/unmain.html
Look at 34. under Obfuscation.
void ClearScreen()
{
#ifdef _POSIX
std: :s ystem ( “clear” );
#endif
#ifdef _WIN32
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord = {0, 0};
DWORD count;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hStdOut, &csbi);
FillConsoleOutputCharacter(hStdOut, ' ', csbi.dwSize.X * csbi.dwSize.Y, coord, &count);
SetConsoleCursorPosition(hStdOut, coord);
#endif
}
requires #include
What I had to do to get it to build on my Linux box.
Still some issues to iron out before it works perfectly on Linux.
You used too many Microsoft-isms in your code like strcpy_s (secure functions). Why not just use the STL string classes?
This was about learning to code C++, and then it helps to keep it as clean as possible and not use any platform specific extensions to C++ or its standard library.
pfft Arrays are SO C
You want Vectors of vectors (for the lols)
also
The projects I work on ( free or contracted ) usually involve windows so it has become a habit to use visual studio C++ code. Also, chars are more fun than std strings.
For linux I’m unsure of a system api call which would allow you to do the same, but you can call the clear command.
#include <stdlib.h>
system("clear");
Which do you think is better in a real-time environment, basic char arrays or string classes?
Probably depends what you do with it…
I’d guess there’s much less overhead if you just loop through an array of chars. But if you do a lot of string operations that are supported by the class, you can be pretty sure it will be as optimized as it could be.