• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 23:04
CEST 05:04
KST 12:04
  • 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
Tournament Spotlight: FEL Cracow 20252Power Rank - Esports World Cup 202576RSL Season 1 - Final Week9[ASL19] Finals Recap: Standing Tall15HomeStory Cup 27 - Info & Preview18
Community News
Google Play ASL (Season 20) Announced18BSL Team Wars - Bonyth, Dewalt, Hawk & Sziky teams10Weekly Cups (July 14-20): Final Check-up0Esports World Cup 2025 - Brackets Revealed19Weekly Cups (July 7-13): Classic continues to roll8
StarCraft 2
General
#1: Maru - Greatest Players of All Time Power Rank - Esports World Cup 2025 What tournaments are world championships? Tournament Spotlight: FEL Cracow 2025 I offer completely free coaching services
Tourneys
Esports World Cup 2025 $25,000 Streamerzone StarCraft Pro Series announced $5,000 WardiTV Summer Championship 2025 WardiTV Mondays FEL Cracov 2025 (July 27) - $10,000 live event
Strategy
How did i lose this ZvP, whats the proper response
Custom Maps
External Content
Mutation #239 Bad Weather Mutation # 483 Kill Bot Wars Mutation # 482 Wheel of Misfortune Mutation # 481 Fear and Lava
Brood War
General
Google Play ASL (Season 20) Announced BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion Flash Announces (and Retracts) Hiatus From ASL Dewalt's Show Matches in China
Tourneys
[Megathread] Daily Proleagues [BSL20] Non-Korean Championship 4x BSL + 4x China CSL Xiamen International Invitational [CSLPRO] It's CSLAN Season! - Last Chance
Strategy
Simple Questions, Simple Answers [G] Mineral Boosting Does 1 second matter in StarCraft?
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Total Annihilation Server - TAForever [MMORPG] Tree of Savior (Successor of Ragnarok) Path of Exile
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
UK Politics Mega-thread US Politics Mega-thread Stop Killing Games - European Citizens Initiative Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
[\m/] Heavy Metal Thread Anime Discussion Thread Movie Discussion! [Manga] One Piece Korean Music Discussion
Sports
2024 - 2025 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 NBA General Discussion
World Cup 2022
Tech Support
Installation of Windows 10 suck at "just a moment" Computer Build, Upgrade & Buying Resource Thread
TL Community
TeamLiquid Team Shirt On Sale The Automated Ban List
Blogs
Ping To Win? Pings And Their…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Socialism Anyone?
GreenHorizons
Eight Anniversary as a TL…
Mizenhauer
Customize Sidebar...

Website Feedback

Closed Threads



Active: 663 users

C++ Cockblockage.. - Page 2

Blogs > Dave[9]
Post a Reply
Prev 1 2 All
Always
Profile Blog Joined March 2009
United States376 Posts
December 10 2009 04:09 GMT
#21
lol this is awesome. i haven't done anything with C++ since 9th grade, but i like how everyone comes in to help
"Do unto others 20% better than you would expect them to do unto you, to correct for subjective error." - Linus Pauling
Disregard
Profile Blog Joined March 2007
China10252 Posts
Last Edited: 2009-12-10 05:19:37
December 10 2009 05:17 GMT
#22
Wow... Java is almost exactly the same. I never noticed.

edit: Not sure but Java is very sensitive with everything, but seems you randomly capitalized "student" in some of the lines that arent related to the name of the program.

I could be wrong, only beginner Java here. :/
"If I had to take a drug in order to be free, I'm screwed. Freedom exists in the mind, otherwise it doesn't exist."
Dave[9]
Profile Blog Joined October 2003
United States2365 Posts
December 10 2009 05:36 GMT
#23
okay, I got way further in my code, and now I'm stuck on the sorting part of it, can more of you have a look?


Love you guys
http://www.teamliquid.net/forum/viewmessage.php?topic_id=104154&currentpage=316#6317
Alphonsse
Profile Blog Joined March 2009
United States518 Posts
December 10 2009 06:26 GMT
#24
The reason it doesn't work right now is you're passing s_sort a single students grades, when the function is expecting arrays containing all of the students grades. Also, you're calling s_sort every time you're reading in an individual students info, when it should only need to be called once.

I would advise changing the s_sort function to accept your array of Student_Statistic structures, instead of a bunch of arrays that represent the fields in those structures. This way, after all of the students have been read in from the file, you can then pass s_sort your array of students, and it will come back sorted.

so instead of:

void s_sort( int x[],string y[],double a[],double b[], int n);

you'd have something like:

void s_sort(Student_Statistics[] students);

Inside the function, you'd have to change x[whatever] to students[whatever].student_id (assuming the x array was representing student_id).
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
December 14 2009 21:08 GMT
#25
doooodeedoooo
"come korea next time... FXO house... 10 korean, 10 korean"
JeeJee
Profile Blog Joined July 2003
Canada5652 Posts
Last Edited: 2009-12-14 21:21:19
December 14 2009 21:12 GMT
#26
On December 10 2009 14:17 Disregard wrote:
Wow... Java is almost exactly the same. I never noticed.

edit: Not sure but Java is very sensitive with everything, but seems you randomly capitalized "student" in some of the lines that arent related to the name of the program.

I could be wrong, only beginner Java here. :/


java's pretty similar
just a lot more fun to program in
god i hate C so much
programming in C is like visiting a dentist who hates you >.<

btw it seems ur current problem is that you're passing .studentID which is an int but your method's expecting an array of ints because that's how you declared it (although in your actual method you're expecting an array of doubles)
stay consistent ;o

also, better variable names never hurt anyone =) arbitrary letters are almost never the way to go aside from for loops or something, and even then .. :p
(\o/)  If you want it, you find a way. Otherwise you find excuses. No exceptions.
 /_\   aka Shinbi (requesting a name change since 27/05/09 ☺)
Cambium
Profile Blog Joined June 2004
United States16368 Posts
December 15 2009 00:35 GMT
#27
This is your definition of s_sort


void s_sort( int x[],string y[],double a[],double b[], int n);


This is what you are passing in

s_sort(Student[i].student_id, Student[i].name, find_lowest(Student[i]), Student[i].letter_grade, i);


All but your last input parameters are incorrectly typed.
When you want something, all the universe conspires in helping you to achieve it.
haduken
Profile Blog Joined April 2003
Australia8267 Posts
December 15 2009 07:20 GMT
#28
simple case of mismatching function arguments.

don't write your code like that. it's messy and when shits go wrong you will kill yourself.

writing any kinda of algorithm in C/C++ is a pain but type checking is very important, you need to get yourself around it.
Rillanon.au
yh8c4
Profile Blog Joined July 2009
108 Posts
December 15 2009 08:20 GMT
#29
you can save yourself some headaches if you use container classes like std::vector<> instead of the built-in [] arrays.
DeathSpank
Profile Blog Joined February 2009
United States1029 Posts
December 15 2009 12:07 GMT
#30
On December 15 2009 17:20 yh8c4 wrote:
you can save yourself some headaches if you use container classes like std::vector<> instead of the built-in [] arrays.

a crutch wont teach you how to walk.
yes.
Prev 1 2 All
Please log in or register to reply.
Live Events Refresh
Next event in 5h 56m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft302
Nina 209
RuFF_SC2 192
StarCraft: Brood War
Sea 4996
NaDa 99
Stork 90
Sharp 59
Sexy 58
HiyA 45
sSak 43
Icarus 8
Dota 2
monkeys_forever1198
LuMiX1
Heroes of the Storm
Khaldor156
Other Games
summit1g13783
tarik_tv10593
JimRising 1047
ViBE210
Organizations
Other Games
gamesdonequick1634
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 11 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo363
Upcoming Events
FEL
5h 56m
BSL20 Non-Korean Champi…
10h 56m
BSL20 Non-Korean Champi…
14h 56m
Bonyth vs Zhanhun
Dewalt vs Mihu
Hawk vs Sziky
Sziky vs QiaoGege
Mihu vs Hawk
Zhanhun vs Dewalt
Fengzi vs Bonyth
Sparkling Tuna Cup
2 days
Online Event
2 days
uThermal 2v2 Circuit
3 days
The PondCast
4 days
Replay Cast
4 days
Korean StarCraft League
5 days
CranKy Ducklings
6 days
Liquipedia Results

Completed

CSLPRO Last Chance 2025
Esports World Cup 2025
Murky Cup #2

Ongoing

Copa Latinoamericana 4
Jiahua Invitational
BSL 20 Non-Korean Championship
BSL 20 Team Wars
FEL Cracov 2025
CC Div. A S7
Underdog Cup #2
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25

Upcoming

ASL Season 20: Qualifier #1
ASL Season 20: Qualifier #2
ASL Season 20
CSLPRO Chat StarLAN 3
BSL Season 21
RSL Revival: Season 2
Maestros of the Game
SEL Season 2 Championship
WardiTV Summer 2025
uThermal 2v2 Main Event
HCC Europe
ESL Pro League S22
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
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.