• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:08
CEST 15:08
KST 22:08
  • 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
Code S Season 1 - RO8 Preview4[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Sea Duckling Open (Global, Bronze-Diamond) Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) RSL Revival: Season 5 - Qualifiers and Main Event Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
Quality of life changes in BW that you will like ? BGH Auto Balance -> http://bghmmr.eu/ RepMastered™: replay sharing and analyzer site Tulbo's ASL S21 Ro8 Post-Review Why there arent any 256x256 pro maps?
Tourneys
[ASL21] Ro8 Day 4 Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Daigo vs Menard Best of 10 Path of Exile OutLive 25 (RTS Game)
Dota 2
The Story of Wings Gaming
League of Legends
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread The Letting Off Steam Thread European Politico-economics QA Mega-thread UK Politics Mega-thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1282 users

The Big Programming Thread - Page 525

Forum Index > General Forum
Post a Reply
Prev 1 523 524 525 526 527 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.
berated-
Profile Blog Joined February 2007
United States1134 Posts
October 02 2014 02:03 GMT
#10481
On October 02 2014 10:03 tofucake wrote:
Show nested quote +
On October 02 2014 08:46 YourGoodFriend wrote:
On October 02 2014 07:38 tofucake wrote:
we don't talk about w3schools around here


Well for JavaScript Mozilla documentation is definitely better. But w3 isn't too bad

http://www.w3fools.com/


I'm not really sure I understand your objective with these types of posts. The ultimate goal should be teaching or helping, not just holding a better than thou type attitude. The guy was at least trying to help, unlike your posts.

I don't use w3schools, nor am I claiming its the best resource ever, but its available and they are trying to provide information to help others. I think Paul Irish says it best on his own github acct.


I'd like to wind down the tone of the site and use it to share positivity. We can recommend evaluating your learning sources, prioritize testing over trusting, and point to how to better develop your knowledge and participation in the community.


I get that it was cool to bash w3schools, but, it just seems less than helpful.
tofucake
Profile Blog Joined October 2009
Hyrule19210 Posts
October 02 2014 03:11 GMT
#10482
W3schools is a bad resource. I don't bash it because it's "the cool thing to do".
Liquipediaasante sana squash banana
Ame
Profile Joined October 2009
United States246 Posts
Last Edited: 2014-10-04 22:36:22
October 02 2014 04:20 GMT
#10483
_Grazze_
Profile Blog Joined December 2006
834 Posts
October 02 2014 15:08 GMT
#10484
Hello!

Code
+ Show Spoiler +

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

int main(void)


{


srand( time(NULL) );
int secretNumber = rand()%100 + 1;
int guess = 0;
int counter = 0;

char input;


printf("Number is %d\n", secretNumber);

printf("I'm thinking of a number between 1 and 100\n");
printf("What is your guess?\n");



while(1)

{

counter++;
scanf("%d", &guess);

if (guess == secretNumber)
{

{
printf("It took you %d tries\n", counter);
printf("Play again? (y/n)?");
scanf("%c", &input);
}

{
break;
}
}

if (guess < secretNumber)
{
printf("Too low!\n");
}

if (guess > secretNumber)
{
printf("Too high!\n");
}


}

system("PAUSE");
return 0;


}


Problem:

I can't figure out how to get the program to start again if I press "y" when it asks "Play again (y/n)?".
I've come to the conclusion that I should use some sort of

do
{
code here
}
while (input == 'y');

but I can't get it to work. :/
nunez
Profile Blog Joined February 2011
Norway4003 Posts
October 02 2014 15:14 GMT
#10485
made acquaintance with as-needed in gcc today.
gcc kept ripping all out the libraries i wanted to link,
didn't notice it happening before i wrote the simplest
of makefiles and ldd'd the binary. grrr...
conspired against by a confederacy of dunces.
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
October 02 2014 15:42 GMT
#10486
On October 03 2014 00:08 _Grazze_ wrote:
Hello!

do
{
code here
}
while (input == 'y');

but I can't get it to work. :/


You are ALMOST there. Won't give you the answer though but you are right on track in using a while loop
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2014-10-02 16:06:07
October 02 2014 15:53 GMT
#10487
--- Nuked ---
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
October 02 2014 16:25 GMT
#10488
--- Nuked ---
_Grazze_
Profile Blog Joined December 2006
834 Posts
October 02 2014 19:09 GMT
#10489
On October 03 2014 00:42 icystorage wrote:
Show nested quote +
On October 03 2014 00:08 _Grazze_ wrote:
Hello!

do
{
code here
}
while (input == 'y');

but I can't get it to work. :/


You are ALMOST there. Won't give you the answer though but you are right on track in using a while loop



I'm just skipping this one lol.

I got it to work if I changed my scanf(%c, &input) to scanf(%d, &input) and changed input to an integer = 1;

So when I pressed 1 when it asked me to play again it worked haha, but not with characters.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-10-02 19:16:56
October 02 2014 19:15 GMT
#10490
I'm learning C++ but my programming background is Java. I have to say though, Java's generics look like complete bullshit compared to C++ 'loose' templates. I like C++ so far even though it may not be as safe as Java.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
October 02 2014 19:22 GMT
#10491
On October 03 2014 04:15 darkness wrote:
I'm learning C++ but my programming background is Java. I have to say though, Java's generics look like complete bullshit compared to C++ 'loose' templates. I like C++ so far even though it may not be as safe as Java.

While templates are much like more powerful generics, that'a just a glimpse of the power of templates. Templates are compile-time turing complete.
If you have a good reason to disagree with the above, please tell me. Thank you.
MichaelEU
Profile Joined February 2011
Netherlands816 Posts
October 02 2014 19:22 GMT
#10492
On October 03 2014 01:25 Nesserev wrote:
[image loading]

Definitely spaces... for some reason, tabs make me feel dirty.


Vimrc!

set autoindent
set shiftwidth=4 " 1 tab = 4 spaces (autoindent)
set softtabstop=4 " 1 tab = 4 spaces (tab key)
set expandtab " never use hard tabs
set shiftround " only indent to multiples of shiftwidth
set smarttab


Definitely spaces, but the tab key is still handy.
世界を革命する力を!― znf: "Michael-oniichan ( *^▽^*)ノ✩キラ✩"
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2014-10-02 19:35:54
October 02 2014 19:23 GMT
#10493
Yay I figured out how to separately trim the numbers from the string e.g. "Page 56 of 95[EXTRACT]" (where the string can be smaller or larger than this in length e.g. "Page 2 of 95[EXTRACT]" is smaller in length and we need some way to detect this). YAY.

This is how I done it (vbs)
+ Show Spoiler +

example string: "Page 55 of 85[EXTRACT]"


pageNumberPage = Mid(pageNumberExtract, 5, (InStr(pageNumberExtract, "of")-6))
'start at char 5 (constant) and give us X characters equal to position of "of" - 6 (due to starting +5)


pageNumberOfPage = Mid(pageNumberExtract,(InStr(pageNumberExtract, "of")+2),((InStr(pageNumberExtract,"EX")-1)-(InStr(pageNumberExtract, "of")+2)))
'start at (position of "of"+2 and give us X characters equal to ( position of "EX" -1 (eg 14)) minus ( position of "of" +2 (eg 10))


msgbox("pageOf " + pageNumberPage + " ofPage " + pageNumberOfPage)

output: pageOf 77 ofPage 95


I set my checkPageNumbers function to 0 if pageOf = ofPage because it means we've run to the final page of the website and if the function is 0 then my "do this on every page" function exits its loop because we no longer need to "do this on every page".

I am smart.

Anyone want to comment on the way I trimmed the string? It looks retarded complicated and took me 1-2 hours.

Also anyone want to comment on how I named variables here? E.g. pageOf. I thought just calling it page was a bit too vague but pageOf looks weird too.

PS I probably should test this more before posting it LOL
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
nunez
Profile Blog Joined February 2011
Norway4003 Posts
October 02 2014 19:35 GMT
#10494
On October 03 2014 00:53 Nesserev wrote:
Show nested quote +
On October 03 2014 00:14 nunez wrote:
made acquaintance with as-needed in gcc today.
gcc kept ripping all out the libraries i wanted to link,
didn't notice it happening before i wrote the simplest
of makefiles and ldd'd the binary. grrr...

Wait, why was it 'ripping out' the libraries?? The as-needed flag should normally not cause any problems, right?

i had never faced it before, so i was quite bemused when it did not find symbols that i knew were in the libraries i linked against, and after a cursory google it seemed like there were some caveats for us uninitiated, relating to ordering of stuff (possibly)... but i did not dwell on it, i just turned it off. it was just a minor assignement.
conspired against by a confederacy of dunces.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-10-02 19:59:14
October 02 2014 19:50 GMT
#10495
On October 03 2014 04:09 _Grazze_ wrote:
Show nested quote +
On October 03 2014 00:42 icystorage wrote:
On October 03 2014 00:08 _Grazze_ wrote:
Hello!

do
{
code here
}
while (input == 'y');

but I can't get it to work. :/


You are ALMOST there. Won't give you the answer though but you are right on track in using a while loop



I'm just skipping this one lol.

I got it to work if I changed my scanf(%c, &input) to scanf(%d, &input) and changed input to an integer = 1;

So when I pressed 1 when it asked me to play again it worked haha, but not with characters.


Don't change your 'input' variable to int. char is fine. Just make sure that you read:

http://stackoverflow.com/a/14419972/1091781

Edit: Nevermind, you already propose a do-while loop to check user's choice.

You may also consider transferring your number guessing code into a function or more, so whenever the user types 'y', you just reuse that function to generate a new number to guess as well as to restart game.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2014-10-02 22:02:59
October 02 2014 20:29 GMT
#10496
edit: reposted my question about Do Loop Until on stackoverflow, please see here :D

why does my Loop Until condition get assessed at the beginning of the loop instead of at the end?

http://stackoverflow.com/questions/26170125/do-loop-until-vbs-loop-condition-is-assessed-at-start
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
MichaelEU
Profile Joined February 2011
Netherlands816 Posts
October 02 2014 20:40 GMT
#10497
On October 03 2014 04:23 FFGenerations wrote:
Yay I figured out how to separately trim the numbers from the string e.g. "Page 56 of 95[EXTRACT]" (where the string can be smaller or larger than this in length e.g. "Page 2 of 95[EXTRACT]" is smaller in length and we need some way to detect this). YAY.

This is how I done it (vbs)
+ Show Spoiler +

example string: "Page 55 of 85[EXTRACT]"


pageNumberPage = Mid(pageNumberExtract, 5, (InStr(pageNumberExtract, "of")-6))
'start at char 5 (constant) and give us X characters equal to position of "of" - 6 (due to starting +5)


pageNumberOfPage = Mid(pageNumberExtract,(InStr(pageNumberExtract, "of")+2),((InStr(pageNumberExtract,"EX")-1)-(InStr(pageNumberExtract, "of")+2)))
'start at (position of "of"+2 and give us X characters equal to ( position of "EX" -1 (eg 14)) minus ( position of "of" +2 (eg 10))


msgbox("pageOf " + pageNumberPage + " ofPage " + pageNumberOfPage)

output: pageOf 77 ofPage 95


I set my checkPageNumbers function to 0 if pageOf = ofPage because it means we've run to the final page of the website and if the function is 0 then my "do this on every page" function exits its loop because we no longer need to "do this on every page".

I am smart.

Anyone want to comment on the way I trimmed the string? It looks retarded complicated and took me 1-2 hours.

Also anyone want to comment on how I named variables here? E.g. pageOf. I thought just calling it page was a bit too vague but pageOf looks weird too.

PS I probably should test this more before posting it LOL


I've never written vbs before. But looks convoluted. Ever tried Split?

page_number_split = Split(page_number_extract)
page_number = page_number_split(1)
extract_idx = InStr(page_number_split(3), "[EXTRACT]")
total_number_of_pages = Left(page_number_split(3), extract_idx)


For naming, I recommend the above. Admittedly does not look as nice in camelCase.
世界を革命する力を!― znf: "Michael-oniichan ( *^▽^*)ノ✩キラ✩"
FFGenerations
Profile Blog Joined April 2011
7088 Posts
October 02 2014 22:17 GMT
#10498
oh nice, so Split defaults to space character and would give me "Page" "#" "of" "#[EXTRACT"
i think thats really good thanks for the insight. i don't know whether to feel smart anymore lol. obviously i saw Split when trying to look at the various functions but didnt think to use it.

posted a new q here btw http://stackoverflow.com/questions/26170125/do-loop-until-vbs-loop-condition-is-assessed-at-start
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
FFGenerations
Profile Blog Joined April 2011
7088 Posts
October 03 2014 14:25 GMT
#10499
hi guys, can you please have a look at this and tell me why my Wscript.exe stays in task manager when i randomly close the application? I'm trying to figure out where to put this shit to catch whatever error it gets when you randomly close it..... it no longer shows an error message when you randomly close it, but wscript stays running in task manager

+ Show Spoiler +


On Error Resume Next

Do

Do While checkSortBy() = 0

If horizontalNumber = -1 Then

iret = iim1.iimClose
WScript.Quit(iret)

ElseIf checkNextLinkExists() Then

clickLink()
modifyControlValues()

Else

clickPreviousLink()

End If

Loop

extract()

clickPreviousLink()

Loop

objFileSystem.Close
strOutputFile.Close
iret = iim1.iimClose
WScript.Quit(iret)

Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Gowerly
Profile Blog Joined July 2011
United Kingdom916 Posts
October 03 2014 15:24 GMT
#10500
Are you not just in a big Do Loop? Even if you close the program, you don't seem to have anything that will break the Do Loop.
I don't know that language, but you may need an equivalent of ThreadAbortException, or something that actually exits the loop?
I will reduce you to a series of numbers.
Prev 1 523 524 525 526 527 1032 Next
Please log in or register to reply.
Live Events Refresh
SC Evo League
13:00
StarCraft Evolution League #22
LiquipediaDiscussion
WardiTV Invitational
11:00
Wardi Spring Cup
Krystianer vs TriGGeR
Cure vs Rogue
WardiTV619
LiquipediaDiscussion
CranKy Ducklings
10:00
Sea Duckling Open #145
CranKy Ducklings47
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Tasteless 1147
Lowko341
Ryung 333
Rex 122
BRAT_OK 9
MindelVK 4
StarCraft: Brood War
Britney 48172
Sea 16704
Calm 8780
Horang2 1318
Mini 848
EffOrt 835
BeSt 594
firebathero 387
Soulkey 300
Zeus 202
[ Show more ]
Last 189
HiyA 127
Mind 109
ToSsGirL 95
Sharp 93
PianO 92
ggaemo 88
Pusan 71
Hyun 52
Backho 48
Shinee 38
sorry 37
Noble 37
Aegong 34
hero 33
Rock 15
yabsab 12
GoRush 11
JulyZerg 10
Sacsri 9
IntoTheRainbow 5
Icarus 4
Dota 2
Gorgc5098
XcaliburYe360
BananaSlamJamma82
LuMiX0
Counter-Strike
fl0m3171
Heroes of the Storm
Khaldor191
Other Games
gofns13129
singsing2438
B2W.Neo1314
DeMusliM336
monkeys_forever121
Livibee81
Mew2King76
ArmadaUGS29
mouzStarbuck17
Organizations
Counter-Strike
PGL17817
Other Games
gamesdonequick2006
StarCraft 2
IntoTheiNu 736
ComeBackTV 526
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• Adnapsc2 15
• Dystopia_ 3
• CranKy Ducklings SOOP2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis3800
• Jankos1301
Upcoming Events
uThermal 2v2 Circuit
1h 52m
BSL
5h 52m
Artosis vs TerrOr
spx vs StRyKeR
Replay Cast
10h 52m
Sparkling Tuna Cup
20h 52m
RSL Revival
20h 52m
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
21h 52m
BSL
1d 5h
Dewalt vs DragOn
Aether vs Jimin
GSL
1d 18h
Afreeca Starleague
1d 20h
Soma vs Leta
Wardi Open
1d 22h
[ Show More ]
Monday Night Weeklies
2 days
OSC
2 days
CranKy Ducklings
2 days
Afreeca Starleague
2 days
Light vs Flash
Replay Cast
3 days
Replay Cast
4 days
The PondCast
4 days
Replay Cast
5 days
RSL Revival
5 days
Korean StarCraft League
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Escore Tournament S2: W6
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
KK 2v2 League Season 1
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

BSL 22 Non-Korean Championship
YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
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.