6,741 Posted Topics

Member Avatar for Joey_Brown

Yes, it's possible. The destination array needs to be large enough to hold the replacement, and the process is rather manual. You'll shift everything to the right of the matching character to make a hole, then overwrite what was in the hole with the new data: [code] # Find 'e' …

Member Avatar for Joey_Brown
0
90
Member Avatar for Frederick2

[QUOTE] In terms of why, my only possible explanation is that there is a different implementation for operator+ and operator+=???[/QUOTE] Consider that operator+= returns a reference to the current object while operator+ returns a new string object.

Member Avatar for Frederick2
0
355
Member Avatar for divyasphoorthy
Member Avatar for Arbus
-2
73
Member Avatar for Akill10

[QUOTE]What is the best way to design a program?[/QUOTE] Opinions will vary, and methodologies can be mutually exclusive (ie top-down vs bottom-up design). Design is actually a pretty deep subject. [QUOTE]Are there any specific steps i should take when designing a program?[/QUOTE] In small programs, I'll just wing it and …

Member Avatar for Akill10
0
121
Member Avatar for divyasphoorthy
Member Avatar for enakta13
Member Avatar for alonewolf23

This is a different matter entirely. The question you linked to was specifically about not printing a line break after hitting the Enter/Return key. Your requirement is merely not to print a newline character, which you're already doing.

Member Avatar for alonewolf23
0
922
Member Avatar for leedsfanatic

You could probably simplify the file operations. What is this program supposed to do?

Member Avatar for peter_budo
0
118
Member Avatar for vedro-compota

I have no idea what you're trying to say (what the hell is "return a book" supposed to mean?), but the file failed to open when fopen returns NULL, not the other way around. Your if statement is reversed.

Member Avatar for vedro-compota
0
121
Member Avatar for reemhatim

You're a [I]second[/I] year CIS student and don't even know where to start? I weep for this generation of programmers. How about starting with one account class and working out the credit/debit actions? From there you can add more accounts, set up branches, etc... This project practically slaps you in …

Member Avatar for reemhatim
0
200
Member Avatar for vedro-compota

addinf and address are both pointers to structures, so you'd need to dereference the pointer before accessing members: [code] (*(*stud.addinf).address).housenumb = 123; [/code] Alternatively, the arrow operator does this for you in a much more convenient manner: [code] stud.addinf->address->housenumb = 123; [/code] Note that those pointers must point to something …

Member Avatar for vedro-compota
0
302
Member Avatar for moroccanplaya

Will an example help? [code] #include <stdio.h> #include <string.h> void dump_file(FILE *in, FILE *out) { int byte; while ((byte = getc(in)) != EOF) putc(byte, out); } int main(void) { /* Use binary if you want to seek arbitrarily */ FILE *in = fopen("test.txt", "rb"); if (in != NULL) { long …

Member Avatar for Narue
0
97
Member Avatar for please1234

[QUOTE]There is at least one person(me) who has not even the faintest idea of what it could be?[/QUOTE] It's an MP3 player. I've been considering buying one for the gym.

Member Avatar for ddanbe
0
62
Member Avatar for zetologos

[QUOTE]why is it allowed to store chars in ints.[/QUOTE] [ICODE]char[/ICODE] is an integer type, just with a smaller range than [ICODE]int[/ICODE]. It makes sense that since [ICODE]int[/ICODE] can hold every value [ICODE]char[/ICODE] can, a widening conversion from [ICODE]char[/ICODE] to [ICODE]int [/ICODE]should be possible. [quote]also if i put getchar in a …

Member Avatar for Narue
0
135
Member Avatar for vedro-compota

Read characters until a newline or EOF is reached: [code] int ch; do ch = getchar(); while (ch != '\n' && ch != EOF); [/code] This is the only portable method, but it also has a downside of blocking for input if the stream is already empty when the loop …

Member Avatar for vedro-compota
0
194
Member Avatar for dip7
Member Avatar for Ancient Dragon
0
3K
Member Avatar for MasterGberry

Static data members [URL="http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/cplr038.htm"]still need to be defined[/URL].

Member Avatar for MasterGberry
0
181
Member Avatar for MasterGberry

[QUOTE]I don't believe the for each (idiom?) exists in C++/CLI.[/QUOTE] It does: [code] #include <iostream> #include <vector> int main() { std::vector<int> v; for (int i = 0; i < 10; i++) v.push_back(i); // C++/CLI foreach for each (int x in v) std::cout<< x <<'\n'; } [/code]

Member Avatar for MasterGberry
0
881
Member Avatar for BigDeveloper

Whoa, [URL="http://www.daniweb.com/forums/thread335181.html"]deja vu[/URL].

Member Avatar for BigDeveloper
0
147
Member Avatar for Maria5683

Something along these lines: [code] import java.util.*; class Main { public void display_menu() { System.out.println ( "1) Option 1\n2) Option 2\n3) Option 3" ); System.out.print ( "Selection: " ); } public Main() { Scanner in = new Scanner ( System.in ); display_menu(); switch ( in.nextInt() ) { case 1: System.out.println …

Member Avatar for fairy1992224
-2
46K
Member Avatar for ethanbuckley
Member Avatar for jonsca
0
121
Member Avatar for ethanbuckley

You didn't post enough code for me to be sure, but from the error I'd guess filePath is a data member and you're doing something like this: [code] ref class Form1 { String^ filePath = this->listView1->CheckedItems[0]->SubItems[2]->Text; // ... }; [/code] C++ doesn't work like that though, you want to do …

Member Avatar for jonsca
0
162
Member Avatar for thecstudent

[URL="http://en.wikipedia.org/wiki/Inter-process_communication"]Use IPC techniques[/URL]. In particular, a pipe would be best suited. Of course you're totally over-engineering the problem and making it ten times harder than it should be. :icon_rolleyes:

Member Avatar for thecstudent
0
309
Member Avatar for moroccanplaya

What does your archive file format look like? A simple format would consist of records like so: [code] struct record { size_t size; unsigned char *bytes; }; void write_record(FILE *out, struct record *rec) { fwrite(rec->size, sizeof rec->size, 1, out); fwrite(rec->bytes, 1, rec->size, out); } int read_record(FILE *in, struct record *rec) …

Member Avatar for Narue
0
285
Member Avatar for sidrules1984

That code shouldn't compile at all, much less output the wrong value. Try this program and see if you get the same erroneous output: [code] #include <stdio.h> int main(void) { int a = 10, b; b = (a >= 5) ? 100 : 200; printf("%d\n", b); return 0; } [/code]

Member Avatar for Narue
0
111
Member Avatar for thelostboy

[QUOTE]What I 1as wondering is this a gd way to get experience with the intention of obtaining a job in software development when I leave uni?[/QUOTE] Work on a project with public exposure so that you can use it in your portfolio. Open source projects are a fantastic option because …

Member Avatar for TSims11
0
160
Member Avatar for MasterGberry

[B]>using namespace System[/B] Just add a semicolon and you should be solid: [code] using namespace System; [/code] [QUOTE]How do i do an internal class in C++?[/QUOTE] The private keyword at class level has the same semantics as internal in C#: [code] private ref class UserFeedback { public: static void Error(Exception^ …

Member Avatar for MasterGberry
0
256
Member Avatar for NickPatton

difftime returns the difference in seconds: [code] #include <stdio.h> #include <time.h> time_t get_date(int year, int month, int day) { time_t start = time(NULL); struct tm *date = localtime(&start); date->tm_year = year - 1900; date->tm_mon = month - 1; date->tm_mday = day; return mktime(date); } int main(void) { time_t bday = …

Member Avatar for NickPatton
0
233
Member Avatar for cute cat

I wouldn't recommend recursion for this problem, but you also didn't ask a question. You just posted your requirements, which strongly suggests that by "help" you really mean "do it for me". :icon_rolleyes:

Member Avatar for Red Goose
0
202
Member Avatar for thelostboy

[QUOTE]I was thinking a pointer or something along those lines any idea guys?[/QUOTE] A pointer to what? You clearly need to know how to send an email, and you need to be able to find the email address of any restaurant in the chain. Sending emails is straightforward (if not …

Member Avatar for Narue
0
118
Member Avatar for nhes2x

Do it your damn self. If you have a specific problem with your code, we'll help, but don't expect anyone to do everything for you.

Member Avatar for danholding
-1
156
Member Avatar for wrathmakin

[QUOTE]What I would like to do however is code it so the user can enter multiple numbers until the user enters 40 and then display the histogram accordingly[/QUOTE] You have the basic idea of building a histogram, so just throw that inside of a loop: [code] while (std::cin>> grade && …

Member Avatar for wrathmakin
0
4K
Member Avatar for TomaCukor

Turbo C is a 16-bit compiler, which essentially means that the actual range of int is [32,767, -32,768] (16 bits, two's complement). It simply can't handle 800000, but long can. The fix in your case is to change your code to use long instead of int. As a side note, …

Member Avatar for Narue
0
136
Member Avatar for Stefano Mtangoo

A forward declaration does nothing but introduce the name of a type into the current scope. Headers typically provide full declarations, which include member information as well as the type name.

Member Avatar for Narue
0
107
Member Avatar for bazigar286

[QUOTE]Please tell me how can I make this application easily?[/QUOTE] Microsoft Access.

Member Avatar for Narue
0
140
Member Avatar for Jelte12345

I actually posted a code snippet the other day that implements a fast line search example. You still get the slowness, but only once when indexing the file. Subsequent searches are much faster.

Member Avatar for arkoenig
0
562
Member Avatar for Cup of Squirrel

>Though you may be able to compile C code in Dev-C++. You can. You just need to be sure that the source file extension is .c instead of .cpp.

Member Avatar for mslade
1
2K
Member Avatar for moroccanplaya
Member Avatar for lionconqueror

Assuming your ints are 32-bit, FFFFFF01 exceeds INT_MAX. strtol should correctly return INT_MAX because the value passed in is out of range. While I'm sure you expected strtol to take a value with the sign bit set and produce a negative value, that's not how it works. The values are …

Member Avatar for lionconqueror
0
371
Member Avatar for Ali5152
Member Avatar for johnray31

[QUOTE]I don't think VS can do it.[/QUOTE] No conforming compiler will do it without an extension. Inline definitions must be provided in every translation unit, so it makes far more sense to place the definition in your class definition, or put an external definition in the header. Otherwise you'd need …

Member Avatar for Fbody
0
309
Member Avatar for ashishchoure

[QUOTE]Is this right to say Heap is RAM and Stack is Pagefile(HardDrive)?[/QUOTE] No. Both are RAM-based and both can be swapped into virtual memory if they exceed limits. However, the stack size is not dynamic, so it's less likely to dip into virtual memory than the heap. You can set …

Member Avatar for ashishchoure
0
169
Member Avatar for dophine

[QUOTE]According to the book, it said "This is not guaranteed to remove the third element, even though that was intended. In most real-world STL implementations, it erases both the third and the sixth elements."[/QUOTE] Beware lack of context. Your quote is actually quite wrong when taken out of context, but …

Member Avatar for dophine
0
123
Member Avatar for Elgan

[CODE]for(i =0; i <= elgbotsections.size(); i++);[/CODE] You have a rogue semicolon here that should be removed, it's causing the loop to run to completion without doing anything, then when you try to access the vector, i is out of bounds. Also, it should be [iCODE]i < elgbotsections.size()[/iCODE]. You presently have …

Member Avatar for Elgan
0
222
Member Avatar for Freude
Member Avatar for petmol

Some of your function definitions have a rogue semicolon before the opening brace. Clearly you copy-pasted the declaration and forgot to remove the semicolon.

Member Avatar for VernonDozier
0
209
Member Avatar for SDH1

Your thread class is somewhat confusing because it manages all threads. Compare that to something a bit more single-thread oriented where the calling application manages multiple thread objects: [code] #include <windows.h> namespace jsw { namespace threading { class auto_event { public: auto_event(): _event(CreateEvent(0, false, false, 0)) {} BOOL wait(DWORD timeout …

Member Avatar for Narue
0
104
Member Avatar for TSims11

What are the errors? Copy and paste them instead of paraphrasing, please. Also, how is Window2 defined?

Member Avatar for TSims11
0
165
Member Avatar for GobanToba

[QUOTE]rand()%2 is not guaranted to generate random number.[/QUOTE] rand is a pseudorandom number generator, it's [I]never[/I] guaranteed to be random. Your suggestion is really based on the history of rand, where implementations had a tendency to have very predictable low order bits. The division solution fixed the problem by using …

Member Avatar for Zjarek
0
163
Member Avatar for Kakashi Hatake

[QUOTE]1. How is the code re-usable in OOP ?[/QUOTE] [URL="http://liberty.princeton.edu/Publications/tech03-01_oop.pdf"]Click me[/URL]. [QUOTE]2. How is OOP more secure than Procedural programming?[/QUOTE] OOP is neither less nor more secure than procedural programming. Anyone who told you otherwise was trying to sell OOP by bullshitting. [QUOTE]3. Compared to procedural programming how is OOP …

Member Avatar for mike_2000_17
0
202

The End.