• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:30
CEST 20:30
KST 03:30
  • 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
Classic Games #3: Rogue vs Serral at BlizzCon8[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12[ASL20] Ro24 Preview Pt2: Take-Off7[ASL20] Ro24 Preview Pt1: Runway13
Community News
Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues23LiuLi Cup - September 2025 Tournaments3Weekly Cups (August 25-31): Clem's Last Straw?39Weekly Cups (Aug 18-24): herO dethrones MaxPax6Maestros of The Game—$20k event w/ live finals in Paris76
StarCraft 2
General
SC4ALL: A North American StarCraft LAN Classic Games #3: Rogue vs Serral at BlizzCon #1: Maru - Greatest Players of All Time Geoff 'iNcontroL' Robinson has passed away [G] How to watch Korean progamer Streams.
Tourneys
SC4ALL $6,000 Open LAN in Philadelphia RSL: Revival, a new crowdfunded tournament series LiuLi Cup - September 2025 Tournaments Maestros of The Game—$20k event w/ live finals in Paris WardiTV Mondays
Strategy
Custom Maps
External Content
Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around Mutation # 487 Think Fast
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ alas... i aint gon' lie to u bruh... BW General Discussion [ASL20] Ro16 Preview Pt1: Ascent The Korean Terminology Thread
Tourneys
Small VOD Thread 2.0 [ASL20] Ro16 Group A [ASL20] Ro16 Group B [Megathread] Daily Proleagues
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread The PlayStation 5 General RTS Discussion Thread Iron Harvest: 1920+ Nintendo Switch Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Laptop on Rent in Delhi – Smart Choice for Student
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
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Games Industry And ATVI UK Politics Mega-thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
The Personality of a Spender…
TrAiDoS
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1379 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 15h 30m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 629
BRAT_OK 105
UpATreeSC 101
IndyStarCraft 82
MindelVK 46
Codebar 44
JuggernautJason30
ProTech15
StarCraft: Brood War
Calm 3311
Rain 1459
Bisu 769
Shuttle 715
Mini 438
EffOrt 268
BeSt 216
firebathero 161
Dewaltoss 135
Soulkey 120
[ Show more ]
sSak 105
hero 99
ggaemo 89
TY 40
Rush 35
Mong 33
sas.Sziky 28
Yoon 24
Dota 2
The International125554
Gorgc11499
PGG 42
Counter-Strike
fl0m1100
flusha79
Other Games
Grubby2188
Beastyqt417
Hui .165
RotterdaM164
ToD163
ArmadaUGS120
C9.Mang0116
QueenE65
XaKoH 35
SortOf30
Organizations
Other Games
gamesdonequick1460
BasetradeTV14
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• FirePhoenix11
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• C_a_k_e 1463
• Ler66
• Noizen44
Other Games
• imaqtpie817
• Shiphtur296
Upcoming Events
RSL Revival
15h 30m
Classic vs TriGGeR
ByuN vs Maru
Online Event
17h 30m
Kung Fu Cup
17h 30m
BSL Team Wars
1d
RSL Revival
1d 15h
Maestros of the Game
1d 19h
ShoWTimE vs Classic
Clem vs herO
Serral vs Bunny
Reynor vs Zoun
Cosmonarchy
1d 21h
Bonyth vs Dewalt
[BSL 2025] Weekly
1d 23h
RSL Revival
2 days
Maestros of the Game
2 days
[ Show More ]
BSL Team Wars
3 days
Afreeca Starleague
3 days
Snow vs Sharp
Jaedong vs Mini
Wardi Open
3 days
Sparkling Tuna Cup
4 days
Afreeca Starleague
4 days
Light vs Speed
Larva vs Soma
LiuLi Cup
5 days
The PondCast
6 days
Liquipedia Results

Completed

Copa Latinoamericana 4
SEL Season 2 Championship
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
RSL Revival: Season 2
Maestros of the Game
Chzzk MurlocKing SC1 vs SC2 Cup #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

Upcoming

2025 Chongqing Offline CUP
BSL Polish World Championship 2025
BSL Season 21
BSL 21 Team A
EC S1
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
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.