• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 23:49
CET 04:49
KST 12:49
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy7ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289
Community News
Weekly Cups (March 16-22): herO doubles, Cure surprises3Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool47Weekly Cups (March 9-15): herO, Clem, ByuN win42026 KungFu Cup Announcement6BGE Stara Zagora 2026 cancelled12
StarCraft 2
General
Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Weekly Cups (March 16-22): herO doubles, Cure surprises Weekly Cups (August 25-31): Clem's Last Straw? Team Liquid Map Contest #22 - Presented by Monster Energy What mix of new & old maps do you want in the next ladder pool? (SC2)
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament World University TeamLeague (500$+) | Signups Open RSL Season 4 announced for March-April WardiTV Team League Season 10 KSL Week 87
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026]
External Content
The PondCast: SC2 News & Results Mutation # 518 Radiation Zone Mutation # 517 Distant Threat Mutation # 516 Specter of Death
Brood War
General
mca64Launcher - New Version with StarCraft: Remast BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion Soulkey's decision to leave C9 JaeDong's form before ASL
Tourneys
[ASL21] Ro24 Group B [ASL21] Ro24 Group C 2026 Changsha Offline Cup [ASL21] Ro24 Group A
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Stormgate/Frost Giant Megathread Path of Exile Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Five o'clock TL Mafia Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine YouTube Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Req][Books] Good Fantasy/SciFi books Movie Discussion! [Manga] One Piece
Sports
2024 - 2026 Football Thread Cricket [SPORT] Formula 1 Discussion Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
Funny Nicknames
LUCKY_NOOB
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 6828 users

The Big Programming Thread - Page 240

Forum Index > General Forum
Post a Reply
Prev 1 238 239 240 241 242 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Arnstein
Profile Blog Joined May 2010
Norway3381 Posts
February 07 2013 08:06 GMT
#4781
How can I get a random number between 65 and 65+LETTERS? Right now I use this:
rand() % (LETTERS+65) +65

as I found on a C++ reference web page, but that certainly gives me more stuff than only numbers in range 65-65+LETTERS!

rsol in response to the dragoon voice being heard in SCII: dragoon ai reaches new lows: wanders into wrong game
KaiserJohan
Profile Joined May 2010
Sweden1808 Posts
February 07 2013 08:12 GMT
#4782
Get used to working in an IDE because that is what you will do most of the time anyway.
Plus when you know one IDE, it's not THAT hard to get into others, and you know what to look for.
England will fight to the last American
Tobberoth
Profile Joined August 2010
Sweden6375 Posts
Last Edited: 2013-02-07 08:32:39
February 07 2013 08:18 GMT
#4783
On February 07 2013 06:58 ChrisXIV wrote:
Show nested quote +
On February 07 2013 06:46 Kambing wrote:
On February 07 2013 06:20 ChrisXIV wrote:
I want to start programming in C++, I already know Java. Now I need a (free) compiler that's good for beginners, I tried the Visual Studio one and that was just too much, I want something where I can just easily create a few classes, anything spring to mind?


Make sure you distinguish compiler from IDE. On windows, your only real options for compilers are Microsoft's offering (Visual C++) or gcc via cygwin. What you probably mean is IDE in which case, no, there's no decent, non-complicated learning-level C++ IDE. If VS puts you off, then I recommend simply loading up a text editor and working off the command line as all the other IDEs out there approach similiar level of complexities. Other free windows IDEs for C++ include Eclipse CDT and Qt Creator.

Ah yes, IDE, don't know why I keep forgetting that word.

Hm, that sucks. It's just that clicking through all those options in VS with no idea what they do...oh well, text editor it is, thank you.

I really recommend learning and using Visual Studio. Not only will it definitely be what you work with professionally in the future if you work with windows development, its intellisense is out of this world, once you get used to it, using any other IDE is a dread. Safe to say, Visual Studio is quite a big program to learn and might be daunting at first, but it's surprisingly easy to use once you're used to it and can be customized beyond belief as in what windows it shows etc. It's also ridiculously powerful once you get to know some of the features such as debugging etc.

I'm pretty sure there are tutorials on how VS works and you would only need to know the most important options to start (starting a project, adding classes, building). Personally I only knew how to program Java and Python but was hired as a C# programmer. Learned C# is about a week and started using VS at work immediately. At first it was confusing, but I got used to it very quickly... with a decent manual or tutorial, you should be up and running in no-time.
Abductedonut
Profile Blog Joined December 2010
United States324 Posts
Last Edited: 2013-02-07 08:38:54
February 07 2013 08:32 GMT
#4784
On February 07 2013 17:06 Arnstein wrote:
How can I get a random number between 65 and 65+LETTERS? Right now I use this:
rand() % (LETTERS+65) +65

as I found on a C++ reference web page, but that certainly gives me more stuff than only numbers in range 65-65+LETTERS!




#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

int main(int argc, char *argv[])
{
srand( time(NULL) );
int LETTERS = 96;

for ( int i = 0; i < 100; i++ )
{
printf("Random number: %i \n", rand()%(LETTERS-65)+65 );
}

system("PAUSE");
return 0;
}



It's rand()%(LETTERS-65)+65

*edit* This is obviously assuming LETTERS > 65. Otherwise, you need absolute value.


*edit* If you want to impress your teacher:
rand()%( (LETTERS > 65) ? LETTERS-65 : 65-LETTERS) + 65

Be careful though, if LETTERS == 65 you're boned..
Arnstein
Profile Blog Joined May 2010
Norway3381 Posts
February 07 2013 08:42 GMT
#4785
Letters is actually a CONST INT sat to 6. I am trying to make a function that makes a random char from a-f. So then I would have to get a random number from 65-71. (I am told to use the const though)
rsol in response to the dragoon voice being heard in SCII: dragoon ai reaches new lows: wanders into wrong game
Abductedonut
Profile Blog Joined December 2010
United States324 Posts
February 07 2013 09:08 GMT
#4786
On February 07 2013 17:42 Arnstein wrote:
Letters is actually a CONST INT sat to 6. I am trying to make a function that makes a random char from a-f. So then I would have to get a random number from 65-71. (I am told to use the const though)



#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

int main(int argc, char *argv[])
{
srand( time(NULL) );
const int LETTERS = 6;

for ( int i = 0; i < 100; i++ )
{
printf("Random char: %c \n", rand()%(LETTERS) + 65 );
}

system("PAUSE");
return 0;
}
Arnstein
Profile Blog Joined May 2010
Norway3381 Posts
February 07 2013 09:15 GMT
#4787
Oh god, I'm so stupid

Thanks a lot!
rsol in response to the dragoon voice being heard in SCII: dragoon ai reaches new lows: wanders into wrong game
MisterD
Profile Blog Joined June 2010
Germany1338 Posts
Last Edited: 2013-02-07 20:50:58
February 07 2013 20:50 GMT
#4788
On February 07 2013 11:16 darkness wrote:
I'm having a bit of trouble to understand C memory management. Could you please show me an easy to understand guide? What I also need is perhaps some practical examples where it's crucial to deal with memory instead of stack.

Thanks


there isn't actually much to it. system memory is separated into stack and heap like in most languages. your entire heap is essentially one giant array. Firstly, your compiled program lies somewhere in there. Secondly, you can reserve multiple ranges of slots in there (calling malloc(size) returns the memory address called pointer, which you can think of as the "index in the giant array" so to speak, where your reserved section starts) to store your stuff and once you don't need one anymore you give it back to the system (by calling free(pointer); ) so someone else can use it. Dereferencing a pointer essentially just means to access the value stored at the given index. In case of reading from an actual array that you allocated on the heap for example, you can go "the pointer (where the array starts) plus 3 lots further, read the value at this position".

And then you don't pay attention, iterate one index too far, access a location that doesn't actually belong to you, and either the operating system detects it and shuts you down to prevent hacking or your program crashes because someone else put some numbers there that are not what your code is written to handle.

It is the most precise you can get which benefits performance, on the other hand though it's incredibly tedious and annoying and extremely vulnerable for creating bugs. Stack works like any other programming language.

as for what to put on heap and what on stack: If you reserve a block of memory that's only going to be used in the function you are currently in (and maybe some functions it calls, but it will not escape this scope), then it's fine to put it on the stack (as long as it's not HUGE). Advantage is you don't need to clean it up yourself, it disappears as soon as your method is done executing, and it doesn't interact with all the stuff on the heap. Disadvantage is, it will disappear as soon as your method is done executing. so, if you reserve an area to fill it with data, that will survive for longer than your method (say, load an image for later use), then you will need to put it on the heap by manually reserving space there and you will have to manually free the space again once you don't need it anymore.

Note though that it is possible for the compiler to store some data in the heap although you wrote it in a way that looks like it would be on the stack. But that's transparent and you don't need to care about it at all, it won't interfere with your program. Trust your compiler magic!
Gold isn't everything in life... you need wood, too!
Mistakes
Profile Joined February 2011
United States1102 Posts
February 07 2013 21:34 GMT
#4789
Hi all, I'm having some trouble with this SQL statement. It's probably something stupid easy that I'm just looking past but I'd love some advice.

+ Show Spoiler +
alter table l_employees
add constraint l_employees_hire
check (hire_date > #01/01/1995#);


I need to add a constraint that checks for employees that were hired after 1995, and this statement is giving me an error in MS Access for SQL.
StarCraft | www.psistorm.com | www.twitter.com/MistakesSC | www.twitch.tv/MistakesSC | Seattle
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
February 07 2013 21:38 GMT
#4790
Thanks MisterD.
lilwisper
Profile Joined April 2010
United States2515 Posts
February 07 2013 21:59 GMT
#4791
On February 08 2013 06:34 Mistakes wrote:
Hi all, I'm having some trouble with this SQL statement. It's probably something stupid easy that I'm just looking past but I'd love some advice.

+ Show Spoiler +
alter table l_employees
add constraint l_employees_hire
check (hire_date > #01/01/1995#);


I need to add a constraint that checks for employees that were hired after 1995, and this statement is giving me an error in MS Access for SQL.



Taking a stab at it without being able to see the error code you got, I would say to double check your datatype in hire_date. I believe in Access that the Date datatype handles a bit differently than Text datatype when it comes to doing date comparisons.
Mistakes
Profile Joined February 2011
United States1102 Posts
February 07 2013 22:04 GMT
#4792
It was a syntax incorrect error on CHECK. I just was reading more about it and it looks like there is no way to write it in SQL/Access, you have to use the GUI to check it. Lol. So I wasn't crazy!
StarCraft | www.psistorm.com | www.twitter.com/MistakesSC | www.twitch.tv/MistakesSC | Seattle
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2013-02-08 01:10:35
February 08 2013 01:10 GMT
#4793
imagine how awful the mangled corpses being put together from your 'compiler' would actually look like, if your computer visualized them to you as creations similar to dr. frankensteins monster.

just... one with legs... JUST legs and one eye. just guts lying around with some hair on it. single nails lying around...

at least mine would be. i need to learn to debug, and not just try to comment out single lines and recompile until i "found the error". i need to learn to debug.
conspired against by a confederacy of dunces.
Mistakes
Profile Joined February 2011
United States1102 Posts
February 08 2013 04:28 GMT
#4794
Hi all, I'm back again with another SQL question through MS Access.

I'm trying to get an output of first names in whole and last names with just one letter, a period, and a space like so:

"Skylar Hoy" in the database in a field called (full_name) to:
"Skylar H. "

This is the code that I have:
+ Show Spoiler +

SELECT employee_id,
first_name & ' ' & last_name as full_name
FROM l_employees;


Seems like anything else I try besides just returning the full name, last name in whole, gives me either an error or the wrong output. Suggestions?
StarCraft | www.psistorm.com | www.twitter.com/MistakesSC | www.twitch.tv/MistakesSC | Seattle
Craton
Profile Blog Joined December 2009
United States17281 Posts
Last Edited: 2013-02-08 05:37:18
February 08 2013 05:37 GMT
#4795
Something like

SELECT employee_id, first_name & ' ' & LEFT(last_name, 1) & '.' FROM l_employees;

Probably.
twitch.tv/cratonz
Mistakes
Profile Joined February 2011
United States1102 Posts
February 08 2013 06:23 GMT
#4796
Awesome, I'll give it a shot when I get home. tyty.
StarCraft | www.psistorm.com | www.twitter.com/MistakesSC | www.twitch.tv/MistakesSC | Seattle
Mistakes
Profile Joined February 2011
United States1102 Posts
February 08 2013 08:28 GMT
#4797
On February 08 2013 14:37 Craton wrote:
Something like

SELECT employee_id, first_name & ' ' & LEFT(last_name, 1) & '.' FROM l_employees;

Probably.


That worked perfectly! Thank you very much. :D
StarCraft | www.psistorm.com | www.twitter.com/MistakesSC | www.twitch.tv/MistakesSC | Seattle
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
February 08 2013 20:00 GMT
#4798
Does anyone here have any experience with iOS development, specifically Core Data? I'm having some issues with multiple persistent stores, where a managed object context using one persistent store will change another managed object context that's using a different persistent store. I can go into more details if needed, but I'm not sure if anyone here has done this kind of thing before.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-02-09 15:14:09
February 09 2013 15:11 GMT
#4799
I'm currently learning C which I wanted to do eventually, but I gotta say Java is a much higher level language. I've realised this when I had to deal with getchar() and putchar(). Also Java's error detection is superior.

I hope C++ surprises me more tho.

Edit: Oh yeah, no built-in threads & classes feature. I've heard of pthread, but isn't this something that doesn't come as standard?
CptCutter
Profile Joined September 2010
United Kingdom370 Posts
February 09 2013 16:45 GMT
#4800
On February 10 2013 00:11 darkness wrote:
I'm currently learning C which I wanted to do eventually, but I gotta say Java is a much higher level language. I've realised this when I had to deal with getchar() and putchar(). Also Java's error detection is superior.

I hope C++ surprises me more tho.

Edit: Oh yeah, no built-in threads & classes feature. I've heard of pthread, but isn't this something that doesn't come as standard?


I have not learnt any C, but im guessing its similar to programming c++ procedurally. anyways, you will find out that java is amazing for the error messages it gives, but is generally a pain in the ass due to other reasons. And then you will find out that C++ is generally better due to having strict control over pointers, but a pain in the ass when your linking goes screwy or you programmed a large piece of code, and spend hours trying to find the "trying to access wrong memory" error.

I generally tend to prefer C++ even with its annoying error messages because it gives far more control over the programming. C# is nice too.
Prev 1 238 239 240 241 242 1032 Next
Please log in or register to reply.
Live Events Refresh
PiGosaur Cup
00:00
#74
PiGStarcraft314
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 198
ProTech123
SpeCial 25
StarCraft: Brood War
GuemChi 5824
Noble 39
ajuk12(nOOB) 24
Bale 22
ggaemo 3
Dota 2
monkeys_forever714
Counter-Strike
Coldzera 1891
Super Smash Bros
hungrybox540
Other Games
C9.Mang0343
PiGStarcraft314
Maynarde110
ViBE63
Temp01
Organizations
Other Games
gamesdonequick1362
Dota 2
PGL Dota 2 - Main Stream60
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH87
• practicex 7
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV1120
League of Legends
• Lourlo937
Other Games
• Scarra1511
Upcoming Events
Replay Cast
5h 11m
Afreeca Starleague
6h 11m
hero vs YSC
Larva vs Shine
Kung Fu Cup
7h 11m
Replay Cast
20h 11m
KCM Race Survival
1d 5h
The PondCast
1d 6h
WardiTV Team League
1d 8h
OSC
1d 8h
Replay Cast
1d 20h
WardiTV Team League
2 days
[ Show More ]
RSL Revival
3 days
Cure vs Zoun
herO vs Rogue
WardiTV Team League
3 days
Platinum Heroes Events
3 days
BSL
3 days
RSL Revival
4 days
ByuN vs Maru
MaxPax vs TriGGeR
WardiTV Team League
4 days
BSL
4 days
Replay Cast
4 days
Replay Cast
5 days
Afreeca Starleague
5 days
Light vs Calm
Royal vs Mind
Wardi Open
5 days
Monday Night Weeklies
5 days
OSC
5 days
Sparkling Tuna Cup
6 days
Afreeca Starleague
6 days
Rush vs PianO
Flash vs Speed
Liquipedia Results

Completed

Proleague 2026-03-23
WardiTV Winter 2026
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
BSL Season 22
CSL Elite League 2026
CSL Season 20: Qualifier 1
ASL Season 21
Acropolis #4 - TS6
RSL Revival: Season 4
Nations Cup 2026
NationLESS Cup
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

2026 Changsha Offline CUP
CSL Season 20: Qualifier 2
CSL 2026 SPRING (S20)
Acropolis #4
IPSL Spring 2026
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.