6,741 Posted Topics
Re: You start by figuring out what you want the function to do. Then you work out steps for how to do it. Then you define the function (and possibly even provide a prototype). Finally, you call the function. Read [url=http://catb.org/~esr/faqs/smart-questions.html]this[/url] before posting again, please. | |
Re: Assuming you're using an explicit size variable to store the number of strings: [code=c] int i; for ( i = 0; i < n; i++ ) printf ( "%s\n", pOutData[i] ); [/code] A common alternative is using a null pointer as a sentinel. In that case, it would look like … | |
Re: >Any more ideas from anyone? With that attitude, probably not. Oh wait, that wasn't useful, was it? I guess I shouldn't have replied. :icon_rolleyes: | |
Re: >if you know C you know that in windows.h you can do say >System(""); to execute somthing in the command prompt. Actually, the system function (no caps) is declared in stdlib.h, and it's not restricted to Windows. However, the string you pass represents a command string that you would use … | |
Re: [url]www.flashdaddee.com[/url] has a good forum on operating system development. | |
Re: Why don't you summarize your project directly here instead of requiring us to click around and download files. Most of the regulars aren't willing to go to that kind of effort to help unless they've already invested some time in your education. | |
Re: >I have a problem in doing this and hence i posted my code here for you to help me. That's nice, but you forgot to tell us what the problem is. No offense intended, but I have more interesting things to work on. I'm more likely to work on my … | |
Re: If you want to get to the data that a pointer to void points to, you need to cast it into the correct type first: [code=cplusplus] #include <iostream> int main() { using namespace std; int x = 3; float y = 2.35f; char c = 'A'; void *ptr; ptr = … | |
Re: >is there a command to do this, and which library would i have to include? The function is called rand, and you can find it in the <cstdlib> (stdlib.h if your compiler is old) header. It returns a pseudorandom number between 0 and RAND_MAX, which is usually the same as … | |
Re: >the use of gotos should absolutely never be done A more reasonable guideline is simply to avoid goto until you're confident that you completely understand it and its alternatives. Sadly, too many people take the "never use goto!" as some sort of silly religious mantra and don't bother to actually … | |
Re: 1) cin's >> operator will stop reading a single item when it hits whitespace. Ideally you would use getline to read the whole line, then stringstream to break it apart: [code=cplusplus] #include <iostream> #include <sstream> #include <string> int main() { std::string line; while ( getline ( std::cin, line ) ) … | |
Re: 1) It's generally used for declaring and dereferencing pointers. 2) a_base works with base2dec and b_base works with dec2base. You can name them whatever you want as long as they're valid identifiers. 3) The longest number would be in base 2 (binary), so it makes sense to set the size … | |
Re: Yea...post the Fortran code so that I have a point of reference for what you were trying to do. | |
Re: >after the addition i want to return the local object "result" through a pointer That won't work. Local variables are destroyed when execution leaves their containing scope. What you [I]should[/I] be doing is returning a copy of the local variable. | |
Re: >could you give me some examples of how you >determine cost for the products that you develop? For software I develop as a consultant, I typically multiply the estimated hours by my hourly rate ($200USD) for the full price. Half of the price is due on signing of the statement … | |
Re: >receive the sold value for each item The "for each" part suggests that you need a loop unless you can guarantee that the sold value is identical for all items: [code] start get <sold items> for number = 1 to <sold items> get <sold value> sum = sum + <sold … | |
Re: Just so you know, a switch isn't well suited to selecting ranges. As the range grows, your switch will become progressively more complicated because you have to specify every possible value in the range. Here's the equivalent switch: [code=cplusplus] switch ( SalesType ) { case 5: case 4: TypeName = … | |
Re: >thats what im doing... Actually, you aren't doing anything at all since you haven't posted any code. >but it doesnt work... I keep saying this, but it keeps falling on deaf ears. "It doesn't work" is utterly, completely, totally useless! Clearly it doesn't work, otherwise you wouldn't be asking for … | |
Re: >I am wondering why size_t is used when it has the same functionality as an int Because it doesn't have the same functionality as int in all cases. size_t is an unsigned type and int is a signed type. That alone will cause warnings and sometimes odd behavior. size_t is … | |
Re: >i just want 2 ask tht how czn i select the topice 4 project.... >tell me let u one thing tht i am a beginner... Wow, it's like you didn't even try to make your post comprehensible. Actually, I only see spelling and grammar mistakes like this when people actually … | |
Re: The Date type has a Parse method that will try to convert a string to a date: [code=vbnet] dim s_date1 as string dim s_date as date s_date1 = s_mon & "/" & s_day & "/" & s_year s_date = Date.Parse ( s_date1 ) [/code] | |
Re: >The Point class needs to have member functions that return type Line That sounds like a design flaw, actually. >if I have a situation like this, then in class Line I can only have members of type *Point That's only a problem if both classes are mutually dependent. In other … | |
Re: >I need to read value 1007(hexadecimal) from a file and assign it to a variable. Use the std::hex manipulator (it's in the <ios> header): [code=cplusplus] in>> std::hex >> value; [/code] >and i need to print this value. You mentioned graphics mode, so you probably need to convert the value into … | |
Re: >with out using any type of sort Be more specific, please. You can't use an existing sort function? Any sorting algorithm at all? | |
Re: What have you tried? This is an extremely simple task, so you'll be expected to at least make an attempt. After that, I'll be happy to explain to you the workings of functions and how that relates to C++ syntax. But until then, I'll assume you're too lazy to crack … | |
Re: First, be sure to read [url=http://www.daniweb.com/forums/thread90228.html]this thread[/url]. Second, getline is technically failing, which puts the stream into an error state and stops any further input from ever succeeding. You need to clear the state first: [code] #include <iostream> using namespace std; void main(){ bool exitProgram = false; char selection, message[20]; … | |
Re: Standard C++ doesn't have a string tokenizer, so the class you're using isn't likely to be well known. Perhaps you can be more specific about what's not working and provide some code? | |
Re: .NET doesn't have a StringTokenizer class. If you don't want to use a third party library, you can use the Split method of the String class to get the same effect, or the Regex library. | |
Re: >when I close the dialog, the instance of that Form2 form does not exists anymore Not quite. Here's a common idiom that I see and use for dialogs: [code=csharp] MyDialog dlg = new MyDialog(); if ( dlg.ShowDialog() == DialogResult.OK ) { // Filling a text box, for this example this.textBox1.Text … | |
Re: Nope, you can store strings however you want. I've seen people use linked lists before, for example. And to support broader character sets, you're not restricted to the char type either. However, the de facto standard string is an array of char/wchar_t or an object of basic_string<char>/basic_string<wchar_t>. | |
Re: >I want to know if there is a rule for using template or inheritance in some situation. Inheritance applies to behavior, templates apply to data. It's not a one or the other deal; you can use templates to supplement inheritance and vice versa. | |
Re: Without any more detail than that, I'd say search Google for "learning assembly language". | |
Re: First, your code shouldn't compile because fibArr tries to use implicit int for the return value, which is illegal C++. Second, you don't even try to print the result of fibNum. Third, you should release the memory you allocate in fibArr. Finally, and this is the biggest error, you're not … | |
Re: >I want to create a web based rpg that will includ emany different >charecters such as Master Cheif and Mario and many others. Good luck with the licensing headaches. >I am looking fo some help/ideas/comments. Help: Spend a few years working on less ambitious games. Ideas: Don't rip copyrighted characters. … | |
Re: Here's an example of passing a timer between two forms: [code] Imports System.Windows.Forms Class Form1 Inherits Form Private _timer As Timer Public Sub New() Me.Text = "Form 1" Dim newForm As New Form2 _timer = New Timer _timer.Interval = 5000 AddHandler _timer.Tick, AddressOf TimerElapsed newForm.MyTimer = _timer newForm.Show() End Sub … | |
Re: >I would like to know what people recommend in terms of programming language >or software to develop a front end interface which will interface with a database >which could be Access or an sql. I don't see why Visual Basic isn't a good enough solution for you (both front end … | |
Re: What you're looking for is an empty project. | |
Re: >Is the first entry the most significant bit or what? IIRC, it's or what. >bump Don't bump your threads, it's rude. I mean really, is 30 minutes really that long to wait? It's not like Daniweb is a real-time chat with paid people helping 24/7 or anything. | |
Re: >i wud like u to tell me if its good to use system('cls') No, it's a big security risk, and the system function is painfully slow. >or shall i create a loop of '\n' so that it will jst bring a new screen in front of me...??? This is your … | |
Re: >int main (); Remove the semicolon. >while (! " with\ "reed".aof"()); I can't imagine what you're trying to do here, but it's probably this: [code=cplusplus] while ( !reed.eof() ) [/code] You don't want to close the file in the loop that reads it. Also, using eof() as a loop condition … | |
Re: I'm more inclined to assume that your code is broken. Post a complete program that crashes and we'll be able to help you. | |
Re: >Is it possible to extract this in any way so it will executable code Yes, but it's extremely complicated because you basically need to write a C++ interpreter. | |
Re: >Is it possible to add two hexadecimal numbers in C? Yes: [code=c] int a = 0xA; int b = 0xB; printf ( "%x\n", a + b ); [/code] | |
Re: Your best option is to use the std::string class. It handles memory for you behind the scenes and is dynamic without requiring lengths beforehand: [code=cplusplus] #include <iostream> #include <string> int main() { std::string s; std::cout<<"Enter a string: "; if ( getline ( std::cin, s ) ) std::cout<<"You entered \""<< s … | |
Re: "It doesn't work" isn't helpful. Be specific about how it doesn't work and we'll be in a better position to tell you why it doesn't work. | |
Re: You're opening and closing the files with each iteration of the loop. When you close the file and open it again, you start reading back at the beginning. | |
Re: Standard C++ doesn't support sockets. You need to use a third party library or API. What compiler and OS are you using? | |
Re: >My question is if it is possible to put this: Number == 5 >to a std::string in any way through Replace ? Do you mean you want to use Replace and get "Number == 5"? The short answer is no. If you want that, you need a separate define that … | |
Re: >nice quality for a moderator. Moderators have one job: enforce the rules. Walt's behavior is no more or less restricted than your behavior, and the comment that offends you so much is acceptable according to Daniweb's rules. |
The End.