• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:37
CEST 15:37
KST 22:37
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles1[BSL20] Non-Korean Championship 4x BSL + 4x China7Flash Announces Hiatus From ASL64Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
Weekly Cups (June 30 - July 6): Classic Doubles Program: SC2 / XSplit / OBS Scene Switcher The SCII GOAT: A statistical Evaluation Statistics for vetoed/disliked maps Weekly Cups (June 23-29): Reynor in world title form?
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
SC uni coach streams logging into betting site BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps Flash Announces Hiatus From ASL Player “Jedi” cheat on CSL
Tourneys
[BSL20] Grand Finals - Sunday 20:00 CET [BSL20] Non-Korean Championship 4x BSL + 4x China CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2024! Summer Games Done Quick 2025!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 729 users

The Big Programming Thread - Page 94

Forum Index > General Forum
Post a Reply
Prev 1 92 93 94 95 96 1031 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.
MisterD
Profile Blog Joined June 2010
Germany1338 Posts
November 09 2011 09:53 GMT
#1861
On November 09 2011 11:05 dapierow wrote:
Im having some trouble with array lists and abstract classes in java

im trying to create a method called "add" in my "collection" class for adding an abstract class into an array list, and I have a different class as a test class, the test class will add a subclass of the abstract class but i cannot seem to make the add method work in the "collection" class... I either get an error of cannot use an abstract class or an error of it being pointed to null...


post code, no one can follow that explanation x)
Gold isn't everything in life... you need wood, too!
Millitron
Profile Blog Joined August 2010
United States2611 Posts
November 09 2011 22:13 GMT
#1862
On November 09 2011 18:53 MisterD wrote:
Show nested quote +
On November 09 2011 11:05 dapierow wrote:
Im having some trouble with array lists and abstract classes in java

im trying to create a method called "add" in my "collection" class for adding an abstract class into an array list, and I have a different class as a test class, the test class will add a subclass of the abstract class but i cannot seem to make the add method work in the "collection" class... I either get an error of cannot use an abstract class or an error of it being pointed to null...


post code, no one can follow that explanation x)

You can't really do anything with abstract classes can you? Don't they need to actually be instantiated before you can use them?
Who called in the fleet?
omgbnetsux
Profile Blog Joined April 2004
United States3749 Posts
November 09 2011 22:31 GMT
#1863
On November 10 2011 07:13 Millitron wrote:
Show nested quote +
On November 09 2011 18:53 MisterD wrote:
On November 09 2011 11:05 dapierow wrote:
Im having some trouble with array lists and abstract classes in java

im trying to create a method called "add" in my "collection" class for adding an abstract class into an array list, and I have a different class as a test class, the test class will add a subclass of the abstract class but i cannot seem to make the add method work in the "collection" class... I either get an error of cannot use an abstract class or an error of it being pointed to null...


post code, no one can follow that explanation x)

You can't really do anything with abstract classes can you? Don't they need to actually be instantiated before you can use them?

You can't use them directly but I think his intent is use have a collection of objects that inherit the abstract class. So yeah, he probably needs to create some subclasses of that abstract.
dapierow
Profile Blog Joined April 2010
Serbia1316 Posts
November 09 2011 22:50 GMT
#1864
On November 10 2011 07:31 omgbnetsux wrote:
Show nested quote +
On November 10 2011 07:13 Millitron wrote:
On November 09 2011 18:53 MisterD wrote:
On November 09 2011 11:05 dapierow wrote:
Im having some trouble with array lists and abstract classes in java

im trying to create a method called "add" in my "collection" class for adding an abstract class into an array list, and I have a different class as a test class, the test class will add a subclass of the abstract class but i cannot seem to make the add method work in the "collection" class... I either get an error of cannot use an abstract class or an error of it being pointed to null...


post code, no one can follow that explanation x)

You can't really do anything with abstract classes can you? Don't they need to actually be instantiated before you can use them?

You can't use them directly but I think his intent is use have a collection of objects that inherit the abstract class. So yeah, he probably needs to create some subclasses of that abstract.


I figured out my question

I did have the subclasses created but since, the sub class is figured out by my test code I had to use the abstract class

my problem was I tried to get the information i needed for my "add" method from an initialized object of the class, rather than the getter from the abstract class (which i totally forgot about). Problemo solved
Eat.Sleep.Starcraft 2
MiyaviTeddy
Profile Blog Joined October 2008
Canada697 Posts
Last Edited: 2011-11-10 04:31:18
November 10 2011 04:30 GMT
#1865
hi guys! I need some help with a problem in c programming :\

so I need to ask the user to input a single character (one of the following: "r", "b" or "p") using scanf. however the problem is to actually check if the inputted data is actually "r, b or p". I wanted to use a while loop to check the input: if it is the correct values, it returns a value back to the main program. otherwise, the loop repeats until the input is correct. Or something like that. I'm familiar with checking input for numbers, but for characters? by the gods I need some help.


char pq;
printf("Enter quality (p: premium, r: regular, b: basic):");
scanf(" %c",&pq);
while (pq != 'r' || 'b' || 'p'){
printf("###Error! Quality must be p, r or b!\n");
printf("Enter quality (p: premium, r: regular, b: basic):");
scanf(" %c",&pq);
}
return pq;

and I can't seem to get the results :\ maybe I'm missing something in the logic tests?
Aiyeeeee
Millitron
Profile Blog Joined August 2010
United States2611 Posts
November 10 2011 04:42 GMT
#1866
On November 10 2011 13:30 MiyaviTeddy wrote:
hi guys! I need some help with a problem in c programming :\

so I need to ask the user to input a single character (one of the following: "r", "b" or "p") using scanf. however the problem is to actually check if the inputted data is actually "r, b or p". I wanted to use a while loop to check the input: if it is the correct values, it returns a value back to the main program. otherwise, the loop repeats until the input is correct. Or something like that. I'm familiar with checking input for numbers, but for characters? by the gods I need some help.


char pq;
printf("Enter quality (p: premium, r: regular, b: basic):");
scanf(" %c",&pq);
while (pq != 'r' || 'b' || 'p'){
printf("###Error! Quality must be p, r or b!\n");
printf("Enter quality (p: premium, r: regular, b: basic):");
scanf(" %c",&pq);
}
return pq;

and I can't seem to get the results :\ maybe I'm missing something in the logic tests?

I would bet that your problem is here:

while (pq != 'r' || 'b' || 'p')

Have you tried splitting it up, so its something like

while (pq != 'r' || pq != 'b' || pq != 'p')

If that doesn't work, try splitting it up further with parenthesis between the statements.
Who called in the fleet?
inkblot
Profile Joined December 2004
United States1250 Posts
November 10 2011 04:52 GMT
#1867
Like Millitron said, you need to write the pq != _ for each character, else it will be interpreted as while ((pq != 'r') || 'b' || 'p' ) which will always be true as 'b' and 'p' count as true in boolean expressions in C. Furthermore, you want to use logical AND rather than OR in this case, ie while(pq != 'r' && pq != 'b' && pq != 'p').
MiyaviTeddy
Profile Blog Joined October 2008
Canada697 Posts
November 10 2011 04:56 GMT
#1868
by the gods it works.

Thanks alot Milli & Ink! I actually understood where it went wrong with the logical Or.
Aiyeeeee
mmp
Profile Blog Joined April 2009
United States2130 Posts
Last Edited: 2011-11-10 09:19:06
November 10 2011 09:18 GMT
#1869
What is your craziest terminal outfit?

Earlier today I had an xmonad workspace with a split layout. On one window was a screen running vim with multiple windows, on the other was another split vim instance inside screen and through ssh. When it came time to switch from one vim to the other (yank & paste), I had to do one keystroke for xmonad, another for screen (vim wasn't the active screen), and another for the correct vim window. Strangely enough I didn't blink and scratch my head until after I had already completed the operation.

I suppose it could have been worse.
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
Kambing
Profile Joined May 2010
United States1176 Posts
November 10 2011 12:47 GMT
#1870
On November 10 2011 18:18 mmp wrote:
What is your craziest terminal outfit?

Earlier today I had an xmonad workspace with a split layout. On one window was a screen running vim with multiple windows, on the other was another split vim instance inside screen and through ssh. When it came time to switch from one vim to the other (yank & paste), I had to do one keystroke for xmonad, another for screen (vim wasn't the active screen), and another for the correct vim window. Strangely enough I didn't blink and scratch my head until after I had already completed the operation.

I suppose it could have been worse.


<3 xmonad. =D
Zhasona
Profile Joined March 2011
57 Posts
Last Edited: 2011-11-16 13:47:15
November 16 2011 09:07 GMT
#1871
Need some help with dereferencing here...

I would like to create a input manipulator with parameters which is similiar to getline function. However, how it will work is the following

cin >> getFileName(input);

where getFileName() is the manipulator and input is an empty c-string that will be passed in and filled with data.

What I did was to create a class with the following prototype:
+ Show Spoiler +

class getFileName {
public:
getFileName(char*);
friend istream& operator>>(istream&, getFileName);

private:
char** inputPtr;
};

getFileName::getFileName(char* input)
{
inputPtr = &input;
}

istream& operator>>(istream& is , getFileName file)
{

cout << *(file.inputPtr) << endl;
return is;
}

int main()
{
char input[50] = "ABC";
cin >> getFileName(input);


The problem is when I call the manipulator, when it gets to the overloading of >> method, it will display garbage when I dereference the char**, despite me passing in a cstring with content. I tried making a char* attribute in getFileName class and let inputPtr point towards it and it will work when dereferencing. So any ideas on where could have gone wrong?

Note: Tried testing on which address inputPtr points to in the constructor and in the operator>> overload and they both point to the same address, yet when dereferenced, 1 gives the content and the other gives garbage.

Edit: Solved the problem by changing all char* type to string type, and passing arguments in constructor by reference.

mmp
Profile Blog Joined April 2009
United States2130 Posts
Last Edited: 2011-11-17 00:36:27
November 17 2011 00:35 GMT
#1872

Please
use
the
code
forum
tag
for
verbatim
monospaced
type
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
Tkorpe
Profile Joined November 2010
Germany6 Posts
November 17 2011 10:08 GMT
#1873
So here is the deal,

im trying to learn c++ for over a year now. I never put much time into it , but recently i managed to create some console applications like snake,hangman,rock paper scissors, and a calculator with a LOT of cool functions. Im getting used to using classes, functions, arrays,loops and all the other basic stuff.

Now i want to go further, but i dont really know how. What would be the next step to learn right now?

My Idea was to create a program which is able to create lists of video files (series,movies) , sort them by different attributes ,like seasons, names , whatever and display them in the main form. Maybe make it be able to let the user chose the path to different folders. It would also be really cool if it could pick a random videofile and play it in a mediaplayer.

Will i be able to realize this with my current knowledge? Is there anything i should go into before this? I guess i should look up how file access works as the next step??

Up to this point ive only been using dev-c++ as compiler. I recently downloaded Virtual c++ , because i wanted to do this with a GUI. Just played a little bit with the toolbox , did nothing else with vc++ so far. It looks really confusing.

So basically im asking for general advices, tips, keywords to search on google to go on.
Or maybe a better idea, what i could do next.

sorry for my bad english.
Greez, Tkorpe




CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2011-11-17 20:06:55
November 17 2011 20:06 GMT
#1874
I figure a good amount of people might be interested in picking up the C language as a beginning programmer, and be interested in learning to code their own game. I'm writing a series of articles on how to create a game through Windows Console, and though it'd be a cool thing to throw up in this thread as well, maybe even include it somewhere in the OP perhaps?

TL Blog about the series of articles.
robih
Profile Joined September 2010
Austria1086 Posts
November 17 2011 21:18 GMT
#1875
use Qt for GUI
its a nice and easy to use GUI library
Craton
Profile Blog Joined December 2009
United States17247 Posts
November 17 2011 21:55 GMT
#1876
In Visual Studio 2010 (C#), is there a way to automatically increment the Version property and ProductCode property of a deployment project when it's built, such that the Version property becomes the AssemblyFileVersion from the project it's using to build the .exe/.msi?

As in, if my project updates to e.g. 1.05.1234 and then I build the installer project, it will in turn update to 1.05.1234 and also update the ProductCode.

I feel this should be a simple task involving the build events, but I can't figure it out.
twitch.tv/cratonz
Frosticles
Profile Joined May 2010
United States50 Posts
November 18 2011 04:06 GMT
#1877
Hi, I am having trouble initializing variables using str.at(). in c++
for example,
if I have a code like

cin >> str;

b = (str.at(0));
c = (str.at(1));

when imputting a string such as 12, it wont initialize properly, and it will instead give me something like
b = 50
c = 58

I don't know why its not initializing properly

Thanks
destian
Profile Joined August 2010
141 Posts
November 18 2011 04:15 GMT
#1878
where does business logic go in an mvvm pattern?

should the viewmodel contain any business logic?
LeafMeAlone
Profile Blog Joined November 2010
United States301 Posts
November 18 2011 05:04 GMT
#1879
You might want to add this link to OP http://stackoverflow.com/questions/194812/list-of-freely-available-programming-books , it's a list of free programming books!
~_~
tarian
Profile Joined August 2010
United States67 Posts
November 18 2011 05:36 GMT
#1880
On November 18 2011 13:06 Frosticles wrote:
Hi, I am having trouble initializing variables using str.at(). in c++
for example,
if I have a code like

cin >> str;

b = (str.at(0));
c = (str.at(1));

when imputting a string such as 12, it wont initialize properly, and it will instead give me something like
b = 50
c = 58

I don't know why its not initializing properly

Thanks

make sure b and c are a string or char
Prev 1 92 93 94 95 96 1031 Next
Please log in or register to reply.
Live Events Refresh
Wardi Open
11:00
#43
WardiTV1322
OGKoka 522
Harstem420
Rex169
IndyStarCraft 165
CranKy Ducklings122
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
OGKoka 522
Harstem 420
Hui .184
Rex 169
IndyStarCraft 165
StarCraft: Brood War
Bisu 3073
Flash 2328
Jaedong 1756
Hyuk 1094
firebathero 707
EffOrt 657
Larva 521
ZerO 478
actioN 454
Soulkey 441
[ Show more ]
Stork 397
Snow 306
Soma 298
GuemChi 163
Mind 133
sSak 118
Light 108
Pusan 106
PianO 94
Sharp 77
JulyZerg 75
hero 73
TY 65
Barracks 48
Sea.KH 44
Aegong 36
sorry 32
Free 29
zelot 27
GoRush 25
HiyA 24
soO 23
Movie 18
JYJ17
yabsab 17
Terrorterran 11
Shine 10
IntoTheRainbow 10
ivOry 5
Dota 2
qojqva3148
Gorgc2576
XaKoH 629
XcaliburYe297
syndereN293
League of Legends
singsing2583
Dendi1
Counter-Strike
byalli270
markeloff134
Super Smash Bros
Mew2King169
Other Games
hiko1144
B2W.Neo1069
crisheroes369
Beastyqt345
Lowko293
ArmadaUGS140
Liquid`VortiX70
ZerO(Twitch)20
Organizations
Other Games
gamesdonequick37693
StarCraft: Brood War
UltimateBattle 978
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 2960
• WagamamaTV335
League of Legends
• Nemesis5594
Upcoming Events
RotterdaM Event
2h 23m
Replay Cast
10h 23m
Sparkling Tuna Cup
20h 23m
WardiTV European League
1d 2h
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
1d 10h
The PondCast
1d 20h
WardiTV European League
1d 22h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
2 days
Replay Cast
2 days
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
[ Show More ]
Replay Cast
3 days
RSL Revival
3 days
Classic vs Cure
FEL
4 days
RSL Revival
4 days
FEL
4 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
6 days
BSL20 Non-Korean Champi…
6 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #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 © 2025 TLnet. All Rights Reserved.