6,741 Posted Topics

Member Avatar for Jboy05

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.

Member Avatar for Narue
0
86
Member Avatar for sjgriffiths

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 …

Member Avatar for Narue
0
84
Member Avatar for bops

>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:

Member Avatar for bops
0
185
Member Avatar for Petrock6

>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 …

Member Avatar for mitrmkar
0
112
Member Avatar for ravi_techinc
Member Avatar for Rachnamb
0
104
Member Avatar for hassanawdah

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.

Member Avatar for SamiMarufi
0
100
Member Avatar for tlox

>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 …

Member Avatar for vmanes
0
347
Member Avatar for amitahlawat20

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 = …

Member Avatar for sahil_itprof
0
151
Member Avatar for 666kennedy

>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 …

Member Avatar for 666kennedy
0
110
Member Avatar for -genESIS-

>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 …

Member Avatar for jephthah
0
111
Member Avatar for Waseemn

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 ) ) …

Member Avatar for Narue
0
100
Member Avatar for Crazycfk

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 …

Member Avatar for Crazycfk
0
110
Member Avatar for mzdiva041986

Yea...post the Fortran code so that I have a point of reference for what you were trying to do.

Member Avatar for mzdiva041986
0
104
Member Avatar for bhoot_jb

>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.

Member Avatar for bhoot_jb
0
259
Member Avatar for _tim

>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 …

Member Avatar for _tim
0
77
Member Avatar for Ben10

>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 …

Member Avatar for Ben10
0
148
Member Avatar for Jboy05

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 = …

Member Avatar for Narue
0
112
Member Avatar for severman

>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 …

Member Avatar for jephthah
0
168
Member Avatar for mod_motox

>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 …

Member Avatar for Narue
0
3K
Member Avatar for Lalarukh khalid

>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 …

Member Avatar for Narue
0
84
Member Avatar for suganzeni

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]

Member Avatar for Narue
0
233
Member Avatar for daviddoria

>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 …

Member Avatar for daviddoria
0
407
Member Avatar for Enjoy

>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 …

Member Avatar for mathmagic
0
225
Member Avatar for severman

>with out using any type of sort Be more specific, please. You can't use an existing sort function? Any sorting algorithm at all?

Member Avatar for jephthah
0
102
Member Avatar for Jboy05

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 …

Member Avatar for Narue
0
85
Member Avatar for JamesMil

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]; …

Member Avatar for Narue
0
87
Member Avatar for dkwantee

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?

Member Avatar for Narue
0
87
Member Avatar for 99.99%

.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.

Member Avatar for Narue
0
37
Member Avatar for yonderboy

>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 …

Member Avatar for Narue
0
359
Member Avatar for Run.[it]

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>.

Member Avatar for Run.[it]
0
97
Member Avatar for dophine

>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.

Member Avatar for Narue
0
139
Member Avatar for CzechRock3

Without any more detail than that, I'd say search Google for "learning assembly language".

Member Avatar for Narue
0
60
Member Avatar for Lensva

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 …

Member Avatar for Lensva
0
126
Member Avatar for coldfirezz

>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. …

Member Avatar for CzechRock3
0
109
Member Avatar for icycool007

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 …

Member Avatar for Narue
0
125
Member Avatar for Kryten

>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 …

Member Avatar for majestic0110
0
148
Member Avatar for Jennifer84
Member Avatar for os.hacker64

>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.

Member Avatar for jephthah
0
99
Member Avatar for bhoot_jb

>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 …

Member Avatar for Majestics
0
3K
Member Avatar for Mander

>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 …

Member Avatar for Mander
0
342
Member Avatar for sahil_itprof

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.

Member Avatar for sahil_itprof
0
115
Member Avatar for Jennifer84

>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.

Member Avatar for Jennifer84
0
108
Member Avatar for mathmagic

>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]

Member Avatar for jephthah
0
6K
Member Avatar for amitahlawat20

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 …

Member Avatar for Narue
0
96
Member Avatar for sanfan49er

"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.

Member Avatar for Narue
0
106
Member Avatar for dan9992

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.

Member Avatar for dan9992
0
84
Member Avatar for crazywoods
Member Avatar for uncertainty

Standard C++ doesn't support sockets. You need to use a third party library or API. What compiler and OS are you using?

Member Avatar for hammerhead
0
112
Member Avatar for Jennifer84

>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 …

Member Avatar for Jennifer84
0
390
Member Avatar for spec80

>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.

Member Avatar for jephthah
0
173

The End.