- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 22
- Posts with Upvotes
- 20
- Upvoting Members
- 18
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Married, two kids, two step-kids, house-owner, non-smoker, GSOH. Will write code for food.
- Interests
- Life, death, the usual stuff.
135 Posted Topics
Re: Hi Nathaliecole, It's always worth searching DaniWeb to see whether your question has been asked before. I searched on the phrase "number system converter" and it threw up this thread, which may help you to get started: > i would like to create a program that converts a number system … | |
[B]Intro[/B] This tutorial provides a brief introduction to the random number functions that come as part of the C++ standard library, namely rand() and srand(). [b]rand() and RAND_MAX [/b] The C++ standard library includes a pseudo random number generator for generating random numbers. In order to use it we need … | |
In C++ we provide names for the entities we create, the variables, functions and types in our programs. These names, or identifiers, are required to conform to some simple rules. [b]Valid Characters [/b] An identifier must start with a letter and is comprised of a sequence of letters and digits. … | |
Re: > warning C4700: uninitialized local variable 'n' used line 39 32. int cost[10][10],i,j,k,n,c,visit,visited[10],l,v,count1,vst,p,dup1,dup2; 39. for(i=0;i<n;i++) You're using n in an expression in line 39, for (i=0; i<n; i++), but it hasn't yet been initialised, so it holds an unknown garbage value. When i is compared with n, you're comparing i … | |
Re: "C++ has GUI features" Well, strictly speaking, C++ has no GUI features whatsoever. It knows nothing about such things, they're simply not part of the C++ language or standard library. If your compiler has GUI features (as many do) they're a platform specific extension. For instance MS VC++ comes with … | |
Re: Hi Joe, Fishman has given you some useful code their to get you going. Note that your own code has several basic syntax errors, which indicate that you're probably still at the "hello world" stage. Do you have a C++ book to refer to? If not, can you lay your … | |
Re: Congratulations on having working code. Are you interested in suggestions for possible improvements? | |
Re: > Need help with this and my professor is teaching way too fast. > I really dont understand any of this and my teacher moves to fast to explain things. This is not really a C++ issue, it's a problem you have with your professor. Nothing we do or say … | |
Re: Hi markwiering, I hear where you're coming from. You're still a fairly raw beginner, so for you, having code that appears to work fine when the expected input is provided probably feels like a good result. And in one sense it is. But you can probably understand where the others … | |
Re: Your loop terminates when either of two conditions occurs: the user indicates there are no more items to scan in or the number of items has reached the maximum (100). Within the loop, the user enters the barcode and quantity, the number of items is updated, and if the limit … | |
Re: What part of the task are you having trouble with? Can you write a simple main() function that asks for and stores values for x and n? That'd get you started. | |
Re: Hi orar, Looks like you're uncertain about functions at the moment. Here: void main() { float input(); float calulate(); float output(); }; Several problems. The first is that you should remove the word float from the function call, e.g. calculate(); The second is that the function is supposed to return … | |
Re: Here: *front = entry[i]; this assigns the character at entry[i] to the memory at the address represented by front, but front hasn't been allocated any memory. I suspect what you want is to assign to the pointer the address of the character, like this: front = &entry[i]; The same applies … | |
Re: Hi Nathan Drake, You know what format input to expect, that's pretty well defined for you, so why not figure out how you intend to store it, then how you're going to read it in. That will get you started, at least. ![]() | |
Re: In addition to what WaltP said, your compare function isn't working as you expect it to. Take a look at what you're comparing -- DiceTotal and AiDiceTotal -- and check whether this is what you intended. | |
Re: You've obviously done quite a lot of work on this already, but I wondered, given that this is C++, whether you'd considered a more object oriented solution (or is that not a possibility for you)? That aside, and given that you've already implemented a fair amount of this yourself, what … | |
Re: Take another look at this line: cin>>a,b,c; Double-check how to handle multiple values with cin. | |
Re: As an aside, C++11 provides an array class which comes with a lot of functionality, if you have a compiler that supports it. | |
Re: Double-check whether this is doing what you expect it to, keeping in mind how many pennies there are in a shilling. temp.shillings = pe / 20; temp.pence = pe % 12; | |
Re: It's surprising how much information an interviewer can obtain even from an incorrect answer. | |
Re: > Write a function, swapSubtrees, that swaps all of the left and right subtrees of a binary tree. Add this function to the class binaryTreeType and create a program to test this function. This was my assignment this week and I am just at a loss I don't even know … | |
Re: Hi Yusuke00, Can you show us what you have so far in the way of code? Thanks | |
Re: Hi jdadkn, The policy here is that you can obtain help, but you won't get your homework done for you. The point of homework is usually not to provide the solution but to learn from having created one, so you'll need to have a go at this problem yourself first … | |
Re: > Well you all have a point guys, we all wanna help each other and it's up to them if they'll just "copy-paste"..- It's not us they're fooling around but theirselves. Right?! They'd also be fooling their instructor. We help by not short-cutting their learning process, which involves them doing … | |
Re: No specific suggestions, but some general advice: choose a project that really interests you. Motivation is that much greater if you choose something you're interested in, therefore you're much more likely to complete it. | |
Re: You need to include the header for the functions. Try: #include <string.h> | |
Re: In the absence of specific details about what you're trying to do, cin is a perfectly good way to input words in C++. | |
Re: Nothing jumps out at me from the code you've posted, but if I've missed something obvious, someone else will surely point it out. Failing that, and because the actual error could be prior to the source line reporting it, could you post the content of tour.h also? | |
Re: Hi chris.vargas.773, #include <iomanip> // for setprecision Your syntax for static_cast is incorrect, s/b static_cast<type>(expression) | |
Re: Thanks for posting your code. Can you tell us, what error are you getting? | |
Re: > standart for what? The standard for the C language, which tells us what to expect from a conforming implementation. > Every compiler have own standart. Those aren't standards, they're specific implementations. > some of them also compatible with ANSI but they have own libraries. Like Microsoft, Borland, Watcom,..... These … | |
Re: For keep_window_open(), check out page 53. For error(), check out page 140. As vijayan121 suggests, these are provided in std_lib_facilities.h which can be downloaded from the related site. | |
Re: Duplicate post. Response posted in the other one. | |
Re: > Q1. What is 'sf' ? Is it a class ? As per myk45's post, it's a namespace, in the same way that std is a namespace. If you're not up to speed with namespaces, a quick check in your C++ reference book should tell you what you need to … | |
Re: What output are you seeing? I don't use SFML, so maybe there's someone better qualified to support you here (or on an SFML-related site). But it looks to me as though you have two threads running, the main thread and a second thread that you launch, and each writes out … | |
Re: Could you post the text of the question, exactly as it was provided to you? That way we'll be able to address any issues with your understanding of it, which is where your uncertainty appears to stem from. | |
Re: Are you looking for someone to hire to write this code for you? I'm currently out of work, so I'll code this for you if you pay me £100, but you'll have to put your money into my Paypal account first. Let me know if you need my Paypal details. … | |
Re: > I have spent hours trying to figure out how to write this program You have the three input values. Looks like you need one or more functions to provide the outputs for display. Are you familiar with writing functions? Are you comfortable with how to store the values produced? | |
Re: Rectangle(int width = 0, int height = 0, int x = 0, int y = 0) : width(width), height(height), x(x), y(y) { x = 500; //does it assign to the x within the class? Does it assign to the parameter x? y = 500; Point(x, y); //which x/y does it … | |
Re: Here's what I think your algorithm is: Point to the first character Loop until the end of the string If current char is lower case make char upper case End if Copy character Point to next character Loop until current char is space or end of string If char is … | |
Re: Hi poloblue, Your function calls look fine to me, in as much as I don't see an obvious problem with the parameters you're passing, unless there's some way in which the code you posted doesn't represent what you're trying to compile (with the code wrapped in a main() function and … | |
*From the Visual C++ Team Blog:* Visual Studio Express 2012 for Windows Desktop is now available for download. http://blogs.msdn.com/b/vcblog/archive/2012/09/12/10348456.aspx Additional details and further discussion here: http://blogs.msdn.com/b/visualstudio/archive/2012/09/12/visual-studio-express-2012-for-windows-desktop-is-here.aspx *ETA: post intended for the News Stories section -- if the Mods could kindly sort that for me?* | |
Re: Hi Tim, The C++ language provides support for sorting and for selecting the maximum value, which makes this really easy. If Dev C++ doesn't come with that support, or if this is homework and you're expected to roll your own, you'll need to sort the values yourself and find the … | |
Re: Hi silvercats, That other thread includes some fairly recent posts about some fairly recent books, so it's worth a read. You can check out the books mentioned on Amazon, use the preview to check whether the content and style looks right for you, for where you're coming to C++ from. … | |
Re: Hi lim9I, When you've fixed the above by bringing main() outside of the class, you might want to just check out the following code within serve() to see if it's doing what you're expecting it to do: if(!empty()) { (num + queue[head]); (head++); return (num); } It's close, but there … | |
Re: Hi satishchavan170, This Wikipedia article will get you started on the concepts of inheritance: http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29 but I'd advise you to get your hands on a good reference book that introduces OO concepts. Do you have any specific questions about inheritance with respect to C++? | |
Re: Hi queos, It looks as though you haven't quite understood about pass-by-reference and pass-by-value yet. Taking this function, for example: float getSales(float sales1, float sales2, float sales3, float sales4) { cout << "enter sales figure until 4: "<<endl; cin >>sales1 >>sales2 >>sales3 >>sales4; cout <<endl; return (sales1, sales2, sales3, sales4); … |
The End.