Where's the fun in that?
A hint though: you don't have any way to access data from loadList()
Forum Index > General Forum |
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. | ||
![]()
tofucake
Hyrule18968 Posts
On April 07 2011 01:24 kuresuti wrote: Could you clarify? Where's the fun in that? A hint though: you don't have any way to access data from loadList() | ||
kuresuti
1393 Posts
On April 07 2011 01:25 tofucake wrote: Show nested quote + On April 07 2011 01:24 kuresuti wrote: On April 06 2011 23:54 tofucake wrote: The solution is & Could you clarify? Where's the fun in that? A hint though: you don't have any way to access data from loadList() Could you give me another hint as to why the process with storing something in names[] works with addName() but not with loadList() aswell? I don't see a difference between the two. | ||
fabiano
Brazil4644 Posts
On April 06 2011 20:56 kuresuti wrote:
I've removed some unnecessary code from there, to keep it clean. Any ideas as to what could be wrong? The parameter names is passed by value and not reference, right? Or is it reference because its an array? I'vent programmed in C/C++ for a while, but if its really passed by value, then you know why it doesnt work, just pass the reference with & | ||
kuresuti
1393 Posts
On April 07 2011 01:43 fabiano wrote: Show nested quote + On April 06 2011 20:56 kuresuti wrote:
I've removed some unnecessary code from there, to keep it clean. Any ideas as to what could be wrong? The parameter names is passed by value and not reference, right? Or is it reference because its an array? I'vent programmed in C/C++ for a while, but if its really passed by value, then you know why it doesnt work, just pass the reference with & It is passed as reference. It works fine in addName(), which indicates that I am doing it right, or that the compiler is doing it wrong but ending up right :O | ||
fabiano
Brazil4644 Posts
| ||
Uriel_SVK
Slovakia427 Posts
On April 06 2011 20:56 kuresuti wrote: + Show Spoiler +
I've removed some unnecessary code from there, to keep it clean. Any ideas as to what could be wrong? ok, not a pro in c/c++, but i think the problem might be that you are not returning the value of names[]. You pass s[] to names[], you add lines to names[], but you do not return lines[] to s[]. In c# i would add ref, but I think in c/c++ it is done with pointers. Or maybe this could work + Show Spoiler +
sorry if it wont help | ||
buhhy
United States1113 Posts
On April 05 2011 04:31 Siniyas wrote: General question for guys with programming experience in java. Is good to learn JSP at this time? I find it very intrigueing and would like to get into it, but all over the it is written, that its dying, since it is now deprecrated as a view for servlets and it seems JSF is taking over. So what should i learn if i want to get into dynamic web design with java? JSF is somewhat different in concept from JSP. It's an additional layer above JSP that manages the backing bean-rendering technology bridge for you. JSF manages a lot of stuff like states for you. JSF 1.2 is built upon JSP, while JSF 2.0 has moved onto facelets for rendering, so JSF and JSP are longer very related. Personally, I like JSF, but I feel it still has quite a way to go, especially with dynamic web design. Using JSF with Javascript is a royal pain in the ass, though JSF 2.0 has fixed a lot of issues. Definitely learn what JSP + Servlets are, and how they work, but I'd lean towards JSF. | ||
buhhy
United States1113 Posts
On April 07 2011 02:03 Uriel_SVK wrote: Show nested quote + On April 06 2011 20:56 kuresuti wrote:
I've removed some unnecessary code from there, to keep it clean. Any ideas as to what could be wrong? ok, not a pro in c/c++, but i think the problem might be that you are not returning the value of names[]. You pass s[] to names[], you add lines to names[], but you do not return lines[] to s[]. In c# i would add ref, but I think in c/c++ it is done with pointers. Or maybe this could work + Show Spoiler +
sorry if it wont help Arrays ARE pointers in C++. Seems weird that the code doesn't work. He's not missing the reference symbol. | ||
kuresuti
1393 Posts
I have no clue why..... as I'm typing this I realize I'm stupid. I have a variable which keeps track of how many elements names contains, but I forgot to add the number of elements loaded in the loadList() function, all my other functions use the counter to output the array etc. etc., which happens to be zero after loadList(). I am very sorry for wasting your time ![]() Thanks for the help though! | ||
buhhy
United States1113 Posts
On April 07 2011 02:42 kuresuti wrote: Okay I've made some progress. I had a menu loop running in which I call loadList(), doesn't work. But if I skip the menu loop altogether and just run loadList() in main it DOES work. I have no clue why..... as I'm typing this I realize I'm stupid. I have a variable which keeps track of how many elements names contains, but I forgot to add the number of elements loaded in the loadList() function, all my other functions use the counter to output the array etc. etc., which happens to be zero after loadList(). I am very sorry for wasting your time ![]() Thanks for the help though! Paste all your code? | ||
kuresuti
1393 Posts
On April 07 2011 03:06 buhhy wrote: Show nested quote + On April 07 2011 02:42 kuresuti wrote: Okay I've made some progress. I had a menu loop running in which I call loadList(), doesn't work. But if I skip the menu loop altogether and just run loadList() in main it DOES work. I have no clue why..... as I'm typing this I realize I'm stupid. I have a variable which keeps track of how many elements names contains, but I forgot to add the number of elements loaded in the loadList() function, all my other functions use the counter to output the array etc. etc., which happens to be zero after loadList(). I am very sorry for wasting your time ![]() Thanks for the help though! Paste all your code? + Show Spoiler [Code] + #include "Lab3.h" (Most of that code is WIP) I might aswell post all of it. All I do in main() is call menuLoop(), and then the code you see takes over from there. curNum in menuLoop() keeps track of the number of elements, as you can see outputList() which I used for checking, loops while i < curNum, and loadList() didn't do anything with curNum so... yeah. To think I've been sitting with this problem for two days makes it hurt even more ![]() EDIT: Might aswell ask while I'm at it. I'm gonna change the system("pause") crap to better stuff later, is there something in the standard library to clear the screen with instead of system("cls")? | ||
Deleted User 101379
4849 Posts
On April 07 2011 03:16 kuresuti wrote: Show nested quote + On April 07 2011 03:06 buhhy wrote: On April 07 2011 02:42 kuresuti wrote: Okay I've made some progress. I had a menu loop running in which I call loadList(), doesn't work. But if I skip the menu loop altogether and just run loadList() in main it DOES work. I have no clue why..... as I'm typing this I realize I'm stupid. I have a variable which keeps track of how many elements names contains, but I forgot to add the number of elements loaded in the loadList() function, all my other functions use the counter to output the array etc. etc., which happens to be zero after loadList(). I am very sorry for wasting your time ![]() Thanks for the help though! Paste all your code? + Show Spoiler [Code] + #include "Lab3.h" (Most of that code is WIP) I might aswell post all of it. All I do in main() is call menuLoop(), and then the code you see takes over from there. curNum in menuLoop() keeps track of the number of elements, as you can see outputList() which I used for checking, loops while i < curNum, and loadList() didn't do anything with curNum so... yeah. To think I've been sitting with this problem for two days makes it hurt even more ![]() EDIT: Might aswell ask while I'm at it. I'm gonna change the system("pause") crap to better stuff later, is there something in the standard library to clear the screen with instead of system("cls")? Welcome to the wonderful world of debugging. The easiest mistakes are the ones that take forever to fix. I once looked 4 hours for a bug that consisted of a semicolon on the wrong line. | ||
buhhy
United States1113 Posts
On April 07 2011 03:25 Morfildur wrote: Show nested quote + On April 07 2011 03:16 kuresuti wrote: On April 07 2011 03:06 buhhy wrote: On April 07 2011 02:42 kuresuti wrote: Okay I've made some progress. I had a menu loop running in which I call loadList(), doesn't work. But if I skip the menu loop altogether and just run loadList() in main it DOES work. I have no clue why..... as I'm typing this I realize I'm stupid. I have a variable which keeps track of how many elements names contains, but I forgot to add the number of elements loaded in the loadList() function, all my other functions use the counter to output the array etc. etc., which happens to be zero after loadList(). I am very sorry for wasting your time ![]() Thanks for the help though! Paste all your code? + Show Spoiler [Code] + #include "Lab3.h" (Most of that code is WIP) I might aswell post all of it. All I do in main() is call menuLoop(), and then the code you see takes over from there. curNum in menuLoop() keeps track of the number of elements, as you can see outputList() which I used for checking, loops while i < curNum, and loadList() didn't do anything with curNum so... yeah. To think I've been sitting with this problem for two days makes it hurt even more ![]() EDIT: Might aswell ask while I'm at it. I'm gonna change the system("pause") crap to better stuff later, is there something in the standard library to clear the screen with instead of system("cls")? Welcome to the wonderful world of debugging. The easiest mistakes are the ones that take forever to fix. I once looked 4 hours for a bug that consisted of a semicolon on the wrong line. ![]() So, your code works correctly now? | ||
kuresuti
1393 Posts
On April 07 2011 03:27 buhhy wrote: Show nested quote + On April 07 2011 03:25 Morfildur wrote: On April 07 2011 03:16 kuresuti wrote: On April 07 2011 03:06 buhhy wrote: On April 07 2011 02:42 kuresuti wrote: Okay I've made some progress. I had a menu loop running in which I call loadList(), doesn't work. But if I skip the menu loop altogether and just run loadList() in main it DOES work. I have no clue why..... as I'm typing this I realize I'm stupid. I have a variable which keeps track of how many elements names contains, but I forgot to add the number of elements loaded in the loadList() function, all my other functions use the counter to output the array etc. etc., which happens to be zero after loadList(). I am very sorry for wasting your time ![]() Thanks for the help though! Paste all your code? + Show Spoiler [Code] + #include "Lab3.h" (Most of that code is WIP) I might aswell post all of it. All I do in main() is call menuLoop(), and then the code you see takes over from there. curNum in menuLoop() keeps track of the number of elements, as you can see outputList() which I used for checking, loops while i < curNum, and loadList() didn't do anything with curNum so... yeah. To think I've been sitting with this problem for two days makes it hurt even more ![]() EDIT: Might aswell ask while I'm at it. I'm gonna change the system("pause") crap to better stuff later, is there something in the standard library to clear the screen with instead of system("cls")? Welcome to the wonderful world of debugging. The easiest mistakes are the ones that take forever to fix. I once looked 4 hours for a bug that consisted of a semicolon on the wrong line. ![]() So, your code works correctly now? Perhaps not correctly, not yet at least. But it works as expected! Thanks again! | ||
Glowbox
Netherlands330 Posts
On April 07 2011 02:10 buhhy wrote: Show nested quote + On April 07 2011 02:03 Uriel_SVK wrote: On April 06 2011 20:56 kuresuti wrote:
I've removed some unnecessary code from there, to keep it clean. Any ideas as to what could be wrong? ok, not a pro in c/c++, but i think the problem might be that you are not returning the value of names[]. You pass s[] to names[], you add lines to names[], but you do not return lines[] to s[]. In c# i would add ref, but I think in c/c++ it is done with pointers. Or maybe this could work + Show Spoiler +
sorry if it wont help Arrays ARE pointers in C++. Seems weird that the code doesn't work. He's not missing the reference symbol. This is not true. They might have similar behavior but they're not the same! (http://www.cplusplus.com/forum/articles/9/) | ||
EscPlan9
United States2777 Posts
Lately I've been concentrating more on my web development skills, which previously were behind my OOP ones. I have a solid grasp of HTML and CSS. I'm also picking up the Adobe Creative Suite (Flash, Photoshop, Premiere, etc) from projects in my Interactive Digital Media Class. However, in my free time I want to learn more about communicating with the server on the web. Say I want to understand how to implement functions like the end-user submits information to the server, the server processes the information and queries a database I create. What languages should I go for next to better understand how to do this? At the moment my web dev track has gone like this: HTML > CSS > JavaScript > DOM > ??? PHP, Ruby, Apache, IIS, ASP .NET, C# .NET all have been recommended for what to learn next. I've tried to hone in on PHP using Apache, but haven't gone far yet since setup has been such a pain in the ass. At the moment PHP isn't able to update Apache's httpd config file and I need to lookup how to manually do that (after taking a good amount of time researching how to get Apache working - which it now does). I guess I have a few questions: 1) What languages should I learn next? 2) Are the options different enough that I should learn both in the end? i.e. ASP.NET vs C#.NET? PHP vs Ruby? Apache vs IIS? 3) Related, but do the different options serve different functions, or is it more of a preference thing? 4) At the moment I am using this for my PHP tutorial: http://devzone.zend.com/node/view/id/627 Because I'm having issues getting PHP properly configured, my test php file just displays its entire contents in plain text (I'm assuming that's the reason I'm not seeing the expected server response). Any suggestions for other tutorials? I didn't see any linked in OP. I know it's a lot of questions, but I want to know more about what some of you recommend for the next steps given what I want to learn. edit: formatting changes | ||
killanator
United States549 Posts
I want to program a few functions into my calculator to save time on the ap test(trapezoid rule, riemann sums) as well as reduce the likelihood of me entering something in wrong. What im not sure is how to ask the user for a function and use that function in the program. this is what i tried :Input"F(X)?Y1 and got a syntax error. and even once i can store it how do i use it in the function to plug x into it? Like im trying to do a for loop for riemann sums and i want to add f(n) to a variable but I dont know how to plug x into the function. The tutorials on the internet arent very helpful, most are very basic or focused on making games. | ||
EvanED
United States111 Posts
On April 07 2011 03:34 Glowbox wrote: Show nested quote + On April 07 2011 02:10 buhhy wrote: Arrays ARE pointers in C++. Seems weird that the code doesn't work. He's not missing the reference symbol. This is not true. They might have similar behavior but they're not the same! (http://www.cplusplus.com/forum/articles/9/) I want to expand on this, because I think that article misses a couple differences, and spends some time on stuff you probably don't care about (e.g. the fact that they assembly output differs). I'd recommend this page instead http://www.lysator.liu.se/c/c-faq/c-2.html for more. (The page talks about C, but with minor changes it applies to C++ as well.) Arrays decay to pointers in C++, meaning there is an automatic conversion, and in some cases they are essentially synonyms (e.g. in a function parameter list), but there is a difference. #include <iostream> Under MSVC 2008, this prints (changed to use the 64-bit compiler): The array says hello world! and has a size of 13 bytes. Under GCC 4.6 on Linux, this prints: The array says hello world! and has a size of 13 bytes. A lot of the time you can pretend that arrays and pointers are the same -- but not all the time. And if your mental model is that they are, and you do enough C/C++ programming, you'll probably get bitten by that at some point. | ||
arioch
England403 Posts
On April 07 2011 05:58 EscPlan9 wrote: A brief intro before my questions... Lately I've been concentrating more on my web development skills, which previously were behind my OOP ones. I have a solid grasp of HTML and CSS. I'm also picking up the Adobe Creative Suite (Flash, Photoshop, Premiere, etc) from projects in my Interactive Digital Media Class. However, in my free time I want to learn more about communicating with the server on the web. Say I want to understand how to implement functions like the end-user submits information to the server, the server processes the information and queries a database I create. What languages should I go for next to better understand how to do this? At the moment my web dev track has gone like this: HTML > CSS > JavaScript > DOM > ??? PHP, Ruby, Apache, IIS, ASP .NET, C# .NET all have been recommended for what to learn next. I've tried to hone in on PHP using Apache, but haven't gone far yet since setup has been such a pain in the ass. At the moment PHP isn't able to update Apache's httpd config file and I need to lookup how to manually do that (after taking a good amount of time researching how to get Apache working - which it now does). I guess I have a few questions: 1) What languages should I learn next? 2) Are the options different enough that I should learn both in the end? i.e. ASP.NET vs C#.NET? PHP vs Ruby? Apache vs IIS? 3) Related, but do the different options serve different functions, or is it more of a preference thing? 4) At the moment I am using this for my PHP tutorial: http://devzone.zend.com/node/view/id/627 Because I'm having issues getting PHP properly configured, my test php file just displays its entire contents in plain text (I'm assuming that's the reason I'm not seeing the expected server response). Any suggestions for other tutorials? I didn't see any linked in OP. I know it's a lot of questions, but I want to know more about what some of you recommend for the next steps given what I want to learn. edit: formatting changes I work as a winform C#/Java developer so I do not have a great deal of experience with web development as a whole, but I can clarify for you on question 2. ASP.NET is a toolkit based on the CLR (Common Language Runtime) so you actually have the option of writing ASP code in any of the .NET programming languages. For future employment though you will have a lot more options if you jump in at the deep end and learn to code C# from the ground up, focusing on client server development. Your best bet is probably to pick up one of the Microsoft Press books, 70-515 is the ASP block MCTS. Another option is to look at enterprise Java development, there is a lot of work about at the moment for people who have experience working with Spring and Hibernate. Obviously I am being boring and looking at it from an employment point of view, but for a budding programmer it is important to start looking at what the market needs as early as you can - C# and Java EE coding jobs are currently on the rise. ![]() | ||
Patagia
United States10 Posts
| ||
| ||
![]() StarCraft 2 StarCraft: Brood War Dota 2 Counter-Strike Super Smash Bros Other Games Organizations
StarCraft 2 • practicex StarCraft: Brood War![]() • v1n1z1o ![]() • LaughNgamezSOOP • AfreecaTV YouTube • intothetv ![]() • Kozan • IndyKCrew ![]() • sooper7s • Laughngamez YouTube • Migwel ![]() League of Legends |
Replay Cast
Replay Cast
SOOP
SKillous vs Spirit
Tenacious Turtle Tussle
PiG Sty Festival
Serral vs TriGGeR
Cure vs SHIN
The PondCast
Replay Cast
PiG Sty Festival
Clem vs Bunny
Solar vs Zoun
Replay Cast
Korean StarCraft League
[ Show More ] PiG Sty Festival
herO vs Rogue
ByuN vs SKillous
SC Evo Complete
[BSL 2025] Weekly
PiG Sty Festival
MaxPax vs Classic
Dark vs Maru
Sparkling Tuna Cup
|
|