1,177 Posted Topics
Re: Or you should have just learned c or c++ in your course! As nbaztec recommended, if you have specific questions we'll be glad to help if you demonstrate that you have thought about/tried them yourself first. | |
Re: That is because you have not [icode]#include <cstdio>[/icode] Also, you should pretty much never include a .cpp file. | |
Re: I use linux and QT. It is annoying to figure out for the first time, but it is really nice once you get used to it. Dave | |
Re: You say "one last question" but I didn't see any questions before that? Also, what do you mean by choice 3 and 4? Please break you question into small parts and give them a shot. If you have a problem with a particular piece of code (maybe < 10 lines … | |
Re: See also: [url]http://www.daniweb.com/forums/thread117408.html[/url] And again: This is another one of those "common" questions that I am recommending cataloging: [url]http://daniweb.uservoice.com/forums/62155-general/suggestions/830529-create-a-wiki-to-catalog-answers-and-examples-?ref=title[/url] Please vote for it! Dave | |
Re: Hi Grusky, welcome to DaniWeb! First, maybe studying the name will be a good place to start. "Linked list" indicates that there are some kind of pieces (elements in the list) that are "linked" together. There is a pretty good description here: [url]http://en.wikipedia.org/wiki/Linked_list[/url]. I'm not an expert, but without a … | |
Re: This looks like a terrible idea! :) [icode]char ss[32556];[/icode] Why not use std::string instead? Dave | |
Any Drupal users out there?? I have created several articles ("Article1", "Article2", etc) and I want to display them on the page called "Projects". Someone told me to look at "views". I went to "structure->views" and there are a bunch of options such as "archive", "backlinks", "comments", etc. but I … | |
| |
Re: I don't understand what you mean by the "vector must be 10", "the vector must be 14", etc. Can you clarify? Dave | |
Re: Welcome to DaniWeb! To make your time here as successful as possible, allow me to recommend a few things: 1) Remember to close your code tag :) 2) Use a descriptive title (i.e. Not "A problem", but rather "A short summary of the specific problem". 3) Try to post < … | |
Re: First, I'm not sure if you actually copied and pasted, but in your A class, [icode] public; [/icode] should be [icode]public:[/icode]. Second, you need semicolons after the closing brace of all of the class definitions. The main problem is that you are defining m_b in the constructor of A (a … | |
Re: hisugan - Welcome to DaniWeb! Here is a very good collection of demonstrations of many concepts in c++: [url]http://www.java2s.com/Code/Cpp/CatalogCpp.htm[/url] Ketsuekiame - Let's all play nice! He is new here, he'll get the hang of it :) | |
Re: I'm sure this is not helpful, but as a data point for you this runs fine for me. [code] #include <iostream> #include <cstdio> #include <cstdlib> int main() { system("/usr/bin/firefox"); return 0; } [/code] Dave | |
Re: What is wrong with [code] system("perl C:\test\perl\a.pl"); [/code] ? | |
Re: I would use a std::vector<std::string> to get an array of strings to the constructor. Any time I see **, I think "there is definitely a better way to do this" :) | |
Re: I agree that it should be at the top. It took me a minute to find it after the change. Dave | |
Re: Unfortunately I don't have answer to your question, but I have two suggestions 1) make a much more descriptive title - this will entice people to investigate your problem 2) Please use code tags. This makes the code that you post much more readable. Dave | |
Re: You absolutely cannot read jpg files with iostream! jpeg is a lossy format which means you need the inverse of the jpeg compression algorithm in order to read it! BMP may be possible, but you're crazy to read it yourself! My suggestion would be to use a library that has … | |
Re: You could simply take the input as a std::string and then use yourString.size(). If there were decimals, you could check each character to see if it is a number using something like this: [url]http://www.java2s.com/Tutorial/Cpp/0040__Data-Types/Usingfunctionsisdigit.htm[/url] [code] int digitCounter = 0; for(unsigned int i = 0; i < yourString.size(); i++) { if(isdigit(yourString[i])) … | |
Re: You need the .c_str() function. If you have a [code] std::string MyString; [/code] and you want to pass it to something that accepts a char*, pass it MyString.c_str() Dave | |
Re: You probably want a 'do while' loop here. The condition of the loop should be if the input is not 0. The content of the loop should be to get the input and get it into a form that it can be compared with 0. Give it a shot and … | |
Re: Welcome to DaniWeb! I have a few tips to get you started. 1) While we understand that English is not everyone's first language, you must still use proper English words. For example "plz" and "thx" are not proper words. 2) You must use code tags when posting code. It makes … | |
Re: Have you looked into using ifstream? This is the "new way" to read files where scanf is the "old way". | |
Re: Glad to hear that you like Daniweb! It does sound like quite a task for a 2 week project. There is a game development forum here that may be able to help you out: [url]http://www.daniweb.com/forums/forum71.html[/url] It seems to me like the key will be to identify the intersection of the … | |
Re: You may also try posting this in the C forum if you don't have any luck here. | |
Re: Sounds like you want to concatenate vectors? You can do [code] vector1.insert( vector1.end(), vector2.begin(), vector2.end() ); [/code] to append vector2 to the end of vector1. An equivalent statement is [code] std::copy(source.begin(), source.end(), std::back_inserter(destination)); [/code] Don't forget to vote for answer cataloging so this can be added to a solution database … | |
Re: You can construct the ssh string in your code (e.g. "scp file server") and then run it using the system() command. Did I understand your question correctly? Dave | |
Re: Welcome to Daniweb! First, please use descriptive titles. This will help you get answers faster as people will be intrigued by your title! To answer your question, my suggestion would be not to use c++! I think you will have much better luck posting this question in the game development … | |
I've seen a couple of "short lists" posted - are you guys aware of [url]http://uservoice.com/[/url] ? Here is a live site if you want to poke around: [url]http://paraview.uservoice.com/[/url] It is a really nice way to (openly) keep a list like this and collect in an extremely organized fashion users wants … | |
Re: What you have described is called "rejection sampling". That sounds like a reasonable way to go about this to me. If you use std::vector to to store the elements you can then use find() from the stl to do the search. It shouldn't be that bad for something as small … | |
I posted this a while ago: [url]http://www.daniweb.com/forums/thread287028.html[/url] Since there were not many replies, I'm assuming something like this doesn't exist? Maybe DaniWeb would like to start one? Just a thought. Dave | |
Re: You may want to ask here: [url]http://www.opengl.org/discussion_boards/[/url] or here: [url]http://www.gamedev.net/community/forums/forum.asp?forum_id=25[/url] | |
Re: Welcome to Daniweb! Although your question is written in c++, you may have better luck with this kind of thing in the Game Development forum: [url]http://www.daniweb.com/forums/forum71.html[/url] Also, be sure to use /code at the end of your code tags so they are applied! I'd also try to simplify your question … | |
Re: Welcome to Daniweb! To produce an executable, you need to "compile" or "build" the code. Also, you should use [icode]#include <iostream>[/icode] and [icode]std::cout << "abc";[/icode] instead of [icode]#include <stdio.h>[/icode] and [icode] printf("abc");[/icode] Hope that helps, Dave | |
Re: I'm not exactly sure what is going on, but it looks like Form1 is in the PublishWizard namespace and you have not given a PublishWizard:: prefix or a "using namespace PublishWizard" when you try to reference Form1 in Utility.h Dave | |
Is the only way to get to the "advanced search" page by searching for a blank string? Should there be an "advanced search" link under the "Search" button? Dave | |
Re: Welcome to Daniweb! Please show us your attempts - we'll be much more inclined to help you fix something you already have instead of writing it for you from scratch :) Can you also clarify the problem? Do you have a list of names? Are they in a std::vector<std::string>? If … | |
Re: You could look into Boost Date/Time: [url]http://www.boost.org/doc/libs/1_43_0/doc/html/date_time.html[/url] | |
Re: You never tell it how big ClassFreq should be, then you start accessing elements! It looks like you should do [code] vector <int> ClassFreq(numberOfClass); [/code] but I'm still not exactly sure what you are trying to do, it seems like there may be a better way using stl functions. Dave | |
Re: [QUOTE]If you are not already a fan on Facebook go here[/QUOTE] I believe they have changed the terminology from "fan" to "like"? I'm not sure what the verb form (similar to "become a fan") of "like" is? "Tell Facebook that you like Daniweb?" haha Dave | |
Re: An adjacency list should simply be a std::vector<std::pair>, right? [url]http://en.wikipedia.org/wiki/Adjacency_list[/url] You look like you have created more of a graph traversal structure here. Unless you are doing this simply as an exercise, there are some graph libraries out there already. I use vtkGraph (I put some examples here: [url]http://www.vtk.org/Wiki/VTK/Examples#Graphs[/url] It … | |
Re: Welcome to Daniweb! First, in the future please use more descriptive titles. This will "help us help you". It will also get more people interested in your question as you can peak their interest with the title. What is QRNA? Please post the smallest compilable code that will produce this … | |
Yesterday I received a "Site Temporarily Unavailable" message on daniweb.com. The instructions asked to send an email to inform Dani of the problem. I bet that almost no one actually does this. Would it make sense to add a button that simply says "click here to report the problem" and … | |
Re: I would use std::stringstream to put the int into a stirng. Then the logic is much more straight forward to get each digit of the string. You can again use stringstream to get each one back to an int before adding them. iamthewee's option also works, but it could be … | |
Re: Can you produce the smallest piece of code that does this and post it here? Dave | |
Re: I'm assuming you mean you have created some kind of table in c++? I would write it out as a CSV (comma separated value) file and the import it into excel using the CSV reader. Dave ![]() | |
Re: If you just want introductory information about c++ and some basic tutorials, I'm sure google has some :) | |
Re: Doesn't sound like you want help with pointers, but more you want us to do your homework! | |
Re: [QUOTE]1. Why doesn't my 'char Menu::getSelection()' from my menu.cpp not display the cout stream? That's all I need it to do, for now.[/QUOTE] I'm assuming by "display the cout stream" you mean it doesn't write anything to the console? I think you may need to flush the buffer by doing … |
The End.