15,300 Posted Topics

Member Avatar for Lass

[quote] for (int d=0;d< fn.length();d++) file_num[d]=fn[d]; [/quote] Why not just use the assignment operator ? No need for that loop [icode]file_num = fn;[/icode] >>string file_name=loction+file_num+extention; That is a little odd. Why not use the fd parameter and delete the loop quoted above ? [icode]string file_name=loction+[color=red]fn[/color]+extention;[/icode] >>ofstream ofile ("file_name", ios::out); Remove …

Member Avatar for mitrmkar
0
170
Member Avatar for elmoro

post the code you have written. Start very simply and do the requirements one at a time. Step 1: For example, [b]"Write a c++ program"[/b]. Well, here it is [code] int main() { // code goes here } [/code] Step 2: Next you need to create an int array that …

Member Avatar for Ancient Dragon
0
69
Member Avatar for still_learning

One way to do that is to create an integer to contain the sum of each group. [code] int sum1 = 0; // 0-20 int sum2 = 0; // 21-40 // etc for each group [/code] Then while reading each value from the file compare it with the gruping [code] …

Member Avatar for Luckychap
0
104
Member Avatar for Moporho

line 57 main.cpp: g.calcAvgHandi(handi, count); handi is an int, not an array. Similar problems with the other lines.

Member Avatar for Ancient Dragon
0
181
Member Avatar for mofoparrot

Your program is experiencing out-of-bounds errors. The arrays are allocated 17 elements numbered 0-16 and your program is attempting to write to elements 1-17. Element #17 does not exist. Learn to count the C and C++ way -- with 0 as the base value. Your program is chuck full of …

Member Avatar for mofoparrot
0
156
Member Avatar for mussa187

Why don't you use c++ strings and vectors instead of re-inventing the wheel [code] #include <string> #include <vector> using std::string; using std::vector; // other using statements here class str_pair { public: str_pair() { counter = 0; } str_pair(string ip, string uri) { this->uri = uri; this->ip = ip; counter = …

Member Avatar for Ancient Dragon
0
114
Member Avatar for rumencho

The or operator is combining those items. For example lets assume #deifne CS_DBLCLKS 0x01 #define CS_OWNDC 0x02 #define CS_HRDRAW 0x04 So when they are or'ed you get 0x01 + 0x02 + 0x04 = 0x07 [URL="http://www.winprog.org/tutorial/"]Here [/URL]is a good beginning tutorial in win32 api programming.

Member Avatar for Duoas
0
123
Member Avatar for rem0404

If you would erase() the element instead of replacing it with an empty string you wouldn't have the problem you are posting.

Member Avatar for Ancient Dragon
0
116
Member Avatar for cb02061

log files are just simple text files. I usually put the date/time at the beginning of the log entry. I wouldn't bother with any of the MFC file functions such as CFile and CArchive. Use normal fstream objects. The log function should open the log file, write the log entry …

Member Avatar for Necrolis
0
3K
Member Avatar for n8makar
Member Avatar for n8makar
0
100
Member Avatar for rkpalmer

I don't understand how sending something thru a comm port is going to generate a timer interrupt ? If you have the source code maybe you can just recompile it with a more modern fortran compiler, such as [URL="http://www.geocities.com/athens/olympus/5564/"]this one.[/URL]

Member Avatar for rkpalmer
0
138
Member Avatar for henpecked1

after using cin call peek() to see if the next character is '\n' or not. [code] int x; cin >> x; if( cin.peek() != '\n') cout << "Bad\n"; [/code] Or get it as a string and check each character.

Member Avatar for henpecked1
0
141
Member Avatar for Aamit

Don't do it like that because it would cause a huge security risk. Instead, have the client pull the file from the server, run it and send results back to server. >>Plz give me hint or any sample code??? Client/server sample code ? You can find some at [URL="Plz give …

Member Avatar for Ancient Dragon
0
86
Member Avatar for web_master

If you want to be able to scroll backwards in the file then you need to keep track of the beginning of each line. call ftell() to get the current byte location, then after reading the next line just call seek() with the location that was returned by ftell(). If …

Member Avatar for jephthah
0
3K
Member Avatar for Agni

>>strcat(screenReturnValue,screenClassName.c_str()); You are attemtping to copy screenClassName into some unallocated memory pointer. [b]screenReturnValue[/b] must be allocated before executing this line, and it must be allocated enough memory to hold both screenClassName and "Ptr". To fix it, use the [b]new[/b] function to allocate the memory [icode] char* screenReturnValue = new char[screenClassName.size() …

Member Avatar for Agni
0
15K
Member Avatar for evlyn
Member Avatar for zandiago
0
21
Member Avatar for GPXtC02

Pass the open stream to each function as a parameter. [code] void func1(ifstream& in) { } void func2(ifstream& in) { } int main() { ifstream in("myfile.txt"); funct1(in); funct2(in); } [/code]

Member Avatar for Ancient Dragon
0
109
Member Avatar for allialli

what part of findMe () don't you know how to code ? Look at this line and you will see what parameters it needs to have. All parameters should be passed by reference. [icode]if (findMe(lookmeup, names, score, tmpscore))[/icode]

Member Avatar for Ancient Dragon
0
128
Member Avatar for infernojmd

>>while (firstName != 0) You can't test std::string objects like that [icode]while(firstName != "")[/icode] might work for you here.

Member Avatar for Ancient Dragon
0
108
Member Avatar for blcase

your coding style is terrible. Don't be afraid to use more white space -- it won't slow down the compile time any and won't take up any more room on your hard drive.

Member Avatar for hacker9801
0
120
Member Avatar for scru
Member Avatar for GrimJack

Narue: I liked the other one better That lady holding the chainsaw and wearing Jason's mask just did something for you. :)

Member Avatar for majestic0110
0
312
Member Avatar for chess_1950

welcome to DaniWeb Chess. Hope you can help out around the Tech Talk boards.

Member Avatar for jbennet
0
31
Member Avatar for hezfast2

line 65: That's a do nothing line, so you might as well delete it. you need 8 ranges so create an int array with 8 elements so that array[0] represents the quantity of numbers within the first range, array[1] is the quantity of numbers in the second range, etc. etc. …

Member Avatar for hezfast2
0
154
Member Avatar for bvrclvr1

[URL="http://www.1728.com/loanform.htm"]Here[/URL] is the formula for calculating the monthly payment [code] int main(){ float loanAmt; float interestRate; int Months; float MonthlyPayment; cout << "Enter load amount ..."; cin >> loanAmt; cout << "Enter interest rate (e.g. 6.5) ..."; cin >> interestRate; cout << "Enter number of months ..."; cin >> Months; …

Member Avatar for bvrclvr1
0
110
Member Avatar for flower77

I think that you need is this: The comments I made are things you need to do to complete the assignment. [code] const int size = 10; // or whatever number you want int number[size] = {0}; // initialize all elements to 0 int key_value = 0; // initialize all …

Member Avatar for Ancient Dragon
0
123
Member Avatar for Firestone

The first number indicate the minimum width of the field, for example "%2d" will print a number at least two characters wide. If the actual number is only one digit the first character will be a space. If the actual number is more than 2 digits the program will display …

Member Avatar for JLChafardet
0
289
Member Avatar for littlestone

I've always read that you should never put code in a constructor that might cause an exception. For example if you need to allocate memory in the contructor then put it in an Initialize() method where the exception can be safely caught and/or thrown.

Member Avatar for Narue
0
168
Member Avatar for DigitalPackrat

>>My problem is with kbhit(), is there no way of resetting it, so that I can reuse it? Yes, extract the character from the keyboard [code] if( kbdhit() ) getche(); // or some other function that extracts the key [/code] >>The restrictions though was that I should use "standard" libraries …

Member Avatar for DigitalPackrat
0
132
Member Avatar for DigitalPackrat

At the end of getData() you need to add code to remove the '\n' from the keyboard buffer. Getting numbers (ints, floats, doubles) has the side affect of cin leaving the Enter key '\n' in the keyboard buffer, so the next time a character string needs to be entered cin …

Member Avatar for DigitalPackrat
0
141
Member Avatar for shotjase

The parameter [b]filename[/b] is going to contain all the bitmap data? :icon_eek: Then where is the name of the file that function is supposed to write it to ? I'd say you need to redesign the parameter(s) to that function because that is just screwy.

Member Avatar for Ancient Dragon
0
90
Member Avatar for stevo356

The next step is to write the implementation c++ code for each of the methods you have in that class. Here's a start: [code] #include "hills.h" // or whatever you named the file you posted // constructor LinkedList::LinkedList() { // initialize the class variables head = 0; tail = 0; …

Member Avatar for Ancient Dragon
0
125
Member Avatar for freakinsweet865
Member Avatar for lavicool

move all the code that is in main into a different function -- just rename main() to something else. Then create a new main() what has a loop that calls that function [code] int some_function() { // blabla return < 0 to end program, or non-0 to continue > } …

Member Avatar for mishraatul
0
154
Member Avatar for zandiago

ban rap music ? No, just clean it up, and it should be the music industry, not the government, that does it. Afterall TV stations wouldn't show Elvis below the waste either because of his lewd shaking of the legs :) In 20 or so years from now today's rap …

Member Avatar for jbennet
0
862
Member Avatar for kv79

>>This could lead in deep discussion about who is made a first gunpowder No deep thought needed to answer that --[URL="http://www.enotes.com/science-fact-finder/general-science-technology/when-where-was-gunpowder-invented"] the Chinese invented gunpower.[/URL]

Member Avatar for jbennet
0
449
Member Avatar for wiglaf

Welcome to DaniWeb. Glad to see that another retired person is here. If you put those classes into a <vector> then you can use std::sort to sort them. All you have to do is write a set of functions that will be called by sort() to return true or false. …

Member Avatar for vijayan121
0
398
Member Avatar for DarkNet

I think it would be a lot easier to move the node's data around instead of trying to move the nodes themselves. Moving the nodes means you have to correct all the links. You don't have to do that if you just move the data.

Member Avatar for Ancient Dragon
0
85
Member Avatar for kylcrow

[URL="http://www.daniweb.com/forums/thread90228.html"]Here is a suggestion [/URL]how to flush the input stream.

Member Avatar for Ancient Dragon
0
75
Member Avatar for jakelley_05
Re: VBA

start [URL="http://msdn2.microsoft.com/en-au/isv/bb190538.aspx"]here[/URL]

Member Avatar for The Dude
0
133
Member Avatar for Nemoticchigga

>>&theMessage That make it a pointer to a pointer. You don't need the & symbol because theMessage is already a pointer [icode]memcpy(&myStruct, theMessage, sizeof(theMessage)); [/icode]

Member Avatar for Nemoticchigga
0
64
Member Avatar for joshmo

zip the project up and attach it to a post. Don't include any object files or other files that are generated by the compiler. And it would be nice to know what operating system and compiler you tried to compile/link with.

Member Avatar for joshmo
0
147
Member Avatar for cloudjc

>>If someone could possibly do the exercise and run my through it, i would be really grateful. I'm sure you would be gradeful. I'll be grateful too if you deposite $10,000.00 USD in my PayPal account. After you do that then I'll gladly email you the program.

Member Avatar for Ancient Dragon
0
431
Member Avatar for dinozulf
Re: help

Anyone have a crystle ball I can borrow? I lost mine somewhere. Also, that seems to be a C program, not c++.

Member Avatar for Salem
0
170
Member Avatar for computers08

add this to the top of your program [code] #include <iostream> using namespace std; [/code]

Member Avatar for Salem
0
95
Member Avatar for demroth

Its a lot simplier in c++ [code] ifstream in("myfile"); int n; in >> n; [/code]

Member Avatar for demroth
0
150
Member Avatar for mbarriault

[URL="http://students.cs.byu.edu/~cs460ta/cs460/labs/sockettutorial.html"]socket tutorial[/URL] and another one [URL="http://www.uwo.ca/its/doc/courses/notes/socket/"]here[/URL] No matter what you do there is some basic amount of socket programming you will have to do.

Member Avatar for Ancient Dragon
0
76
Member Avatar for wsn

>>what makes these two functions better to use over execl and execv? Nothing. It just depends on how you want to use them. As described [URL="http://linux.die.net/man/3/execlp"]here[/URL] execlp will search the PATH environment variable for the executable if [b]path[/b] parameter does not contain a slash.

Member Avatar for wsn
0
104
Member Avatar for chunalt787
Member Avatar for chunalt787
0
82
Member Avatar for Sh13

try fgets() [code] char menuchoice[2]; printf("please enter:"); fgets(menushoice, sizeof(menuchoice), stdin); return menuchoice[0]; [/code]

Member Avatar for Sh13
0
152

The End.