1,174 Posted Topics

Member Avatar for shinpad

If ScheduledIn will be of type char (i.e. char ScheduledIn) then you cannot use double quotation marks in the if expression, use ' ' instead ... [code] char ScheduledIn; ... ScheduledIn = toupper(SchecduledIn); if (ScheduledIn == 'Y' || ScheduledIn == 'N')) { }[/code]

Member Avatar for Nick Evan
0
126
Member Avatar for Aamit

The client needs to specify how much data it sends, i.e. you have to use the value you get from fread(). The server must write only the amount it gets from recvfrom(). The return value of recvfrom() gives you that information. And last but not least, you must add error …

Member Avatar for Prabakar
0
619
Member Avatar for knowledgelover

You may get ideas by looking in here [url]http://blogs.msdn.com/texblog/archive/2007/04/05/linking-native-c-into-c-applications.aspx[/url]

Member Avatar for mitrmkar
0
394
Member Avatar for nurulshidanoni

y is a single integer, so it cannot be passed to the functions as such. You need an array of integers holding the data you have read in. [code]int main() { enum { ARR_SIZE = 3 }; int y[ARR_SIZE] = {0}; // Array of ints, at max ARR_SIZE elements int …

Member Avatar for Arpy Giri
0
170
Member Avatar for Jennifer84

Below is one option, maybe that is what you are after [code] private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) { Form2 ^form2 = gcnew Form2; form2->Show(); } [/code]

Member Avatar for Jennifer84
0
136
Member Avatar for En1ro

obj must NOT be const because you intend to modify it, so use only plain gydytojas& obj i.e. [icode]friend fstream& operator>>(fstream& fs, gydytojas& obj)[/icode]

Member Avatar for En1ro
0
138
Member Avatar for code12

If you are going to set the value of mAccountNumber inside BankAccount::getAccountNumber(), then the function must be [B]non-const[/B], i.e. you need to have it like: [code]size_t BankAccount::getAccountNumber () { // set the value here ... }[/code]

Member Avatar for code12
0
235
Member Avatar for BAEdwards

BCB version 3 is ancient, really consider updating to much more recent version, a full version is available for free, see [url]http://cc.codegear.com/free/cppbuilder[/url] To convince you, given that ThreadFunct1 is a member function of the form class, the following code [icode]ThreadHandle[0] = CreateThread(NULL, 0, ThreadFunct1, this, 0, &ThreadId[0]);[/icode] should not even …

Member Avatar for mitrmkar
0
280
Member Avatar for wam2

>> Why does the DLL did not get other values of the array??? I do not understand that. You output to the very same memory address each calculation [icode]out[[B][COLOR="Red"]0[/COLOR][/B]]=m_A[n+1]; // out[0] output from "C" to PSIM[/icode] shouldn't you change that subscript to follow the for loop? So it would be …

Member Avatar for wam2
0
377
Member Avatar for Spagett912

[code] ... // [B]MaritalType[/B] is undefined at this point void extern displayStatus (MaritalType GrossType); ... [COLOR="Red"]{);[/COLOR] // <-- remove that one int extern getGross (); [/code]

Member Avatar for joshmo
0
153
Member Avatar for cynicalreality

Shouldn't you rather be calling the setType() through the DO pointer instead of BP (assuming that the Base class does not and is not intended to have a setType() method), i.e. DO->setType("hello"); should work.

Member Avatar for mitrmkar
0
160
Member Avatar for tiney83

I think the original findHighest() code was working quite well, to get the actual highest score, simply use person[max].testScore once the index of the highest score is known (i.e. max in this case), so ... [code]int findHighest(studentType person[]) { // assume highest score is at index 0 int max = …

Member Avatar for tiney83
0
140
Member Avatar for Jennifer84
Member Avatar for Jennifer84
0
143
Member Avatar for n1337

The #import directive with Dev C++ is not doing what you expect, practically it is the same as #pragma once i.e. related to include guards instead of type library imports. See e.g. [url]http://www.delorie.com/gnu/docs/gcc/cpp_54.html[/url] If you really want to tackle Office automation, you could switch from Dev C++ to a free …

Member Avatar for n1337
0
313
Member Avatar for Onixtender

<<then the program will print to the result.txt A (last line ,transformed) The reason why this happens is that the push() uses everytime the same buffer (=record), so effectively the stack contains pointers to this single buffer, and what was last written to the buffer, gets printed to the file …

Member Avatar for Prabakar
0
139
Member Avatar for info04

[QUOTE=info04;603372]but what is wrong?[/QUOTE] You are [B]excluding [/B]the lower and upper bounds, so you could change to [icode]if ( i >= 65 && i <= 90 )[/icode] or [icode]if ( i > 64 && i < 91 )[/icode] The standard libraries provide functions for checking characters, see e.g. here [url]http://www.cplusplus.com/reference/clibrary/cctype/[/url]

Member Avatar for William Hemsworth
0
111
Member Avatar for still_learning

[QUOTE=still_learning;601416] So for instance, if I have vector<int> vecList; as my vector and I want to replace vecList[5] with an integer entered by a user, how exactly can I do that? [/QUOTE] Simply by [icode]vecList[5] = int_from_user;[/icode] To lookup a value to change, you can use std::find() [code]#include <algorithm> ... …

Member Avatar for still_learning
0
207
Member Avatar for Prabakar

Anyone interested in programs written in similar fashion can take look at here [url]http://www2.de.ioccc.org/years.html#2004[/url]

Member Avatar for Prabakar
0
156
Member Avatar for nelledawg

[QUOTE=nelledawg;601099]When I select 5 to quit and it asks if I'm sure, if I type "Y" it breaks and I get a window that says "Unhandled exception at 0x1029984f (msvcr90d.dll) in lab 10 FIX.exe: 0xC0000005: Access violation reading location 0x0000000a. [/QUOTE] Change your message() function to following [code]void message(char *msg) …

Member Avatar for nelledawg
0
99
Member Avatar for Jennifer84

You are missing [icode]using namespace System::Collections::Generic;[/icode]

Member Avatar for Jennifer84
0
152
Member Avatar for vedmack

[QUOTE=vedmack;600835]any ideas?[/QUOTE] This is bit vague but an idea anyhow, so here goes ... Use EnumProcesses() to map process ids to executable names, that gives you the process id of the target program. Then use EnumWindows() together with GetWindowThreadProcessId() to figure out the window handle you need to operate on. …

Member Avatar for Ancient Dragon
0
113
Member Avatar for En1ro

[CODE] struct gydytojas { <snip> friend ostream& operator<<(ostream& os, const gydytojas& obj) { // In this function you have to write the data you want // in to the ostream os. // for example, write the integer values os << obj.gydid << obj.amzius << obj.specialyb << obj.telefonas << obj.asmkod; // …

Member Avatar for En1ro
0
180
Member Avatar for Jennifer84

I think you should forget trying to use a String to store and restore a color. Instead, you can simply use a member variable of type System::Drawing::Color to save the original color and restore it back when necessary. So in your Form class, add a member variable like; [icode]System::Drawing::Color ColorSaved;[/icode] …

Member Avatar for Jennifer84
0
144
Member Avatar for welles

I suggest that you familiarize yourself with the concept of passing by reference, including passing by const reference. And while you are at it, check out returning by reference too. Now you are passing vectors by value into functions that are supposed to modify the input, however, that simply will …

Member Avatar for welles
0
100
Member Avatar for blah70

[QUOTE=blah70;599158]Can anyone help me please[/QUOTE] Try proceeding with posting e.g. the code you have written, an explanation of what is failing with it/what you perhaps don't understand, what the program should accomplish and so on.

Member Avatar for ithelp
0
95
Member Avatar for Jennifer84

[QUOTE]So it seems that the decimals is dissapearing in the conversion. [/QUOTE] atoi() converts a character string to an [B]integer[/B] meaning that no decimal points are available. The stringstream is capable of doing the conversion, so you don't need to use any of the C-library conversion routines. [code] std::string Number3 …

Member Avatar for Jennifer84
0
110
Member Avatar for deathevan

[QUOTE=marco93;598704]codeproject has nothing else than copies of MSDN samples.[/QUOTE] That just isn't quite true, you can convince yourself by taking a look, for example, in here [url]http://www.codeproject.com/KB/MFC/UltimateToolbox.aspx[/url]

Member Avatar for deathevan
0
137
Member Avatar for hezfast2

Just a suggestion, have you considered using a struct/class the encapsulates the data of a single item? You could then operate with a vector of such struct/class instead of the many separate vectors you have now. E.g. [code]struct Item { string ID; string Name; double Price; }; void getData(ifstream& infile, …

Member Avatar for VernonDozier
0
221
Member Avatar for En1ro

Below is an arbitrary example, hope it gives some insight [code]#include <fstream> #include <string> using namespace std; class MyClass { string strings[2]; int value; friend ostream & operator << (ostream & stream, const MyClass & obj); public: MyClass(const string & s1, const string & s2, const int n) { strings[0] …

Member Avatar for mitrmkar
0
107
Member Avatar for n3XusSLO

Here is a thread about the books [url]http://www.daniweb.com/forums/thread70096.html[/url]

Member Avatar for n3XusSLO
0
104
Member Avatar for daviddoria

[quote]An example is BestScanPositions.at(0) is 0 and BestScanPositions.at(1) is also 0. Then BestCols.at(0) is 19 and BestCols.at(1) is 16!!! Weird, eh?[/quote] Just guessing .. could it be that you actually do the 'offending' loop twice or more without clearing the vectors' content in between?

Member Avatar for mitrmkar
0
192
Member Avatar for En1ro

vardas is an array of 25 Strings. So if you want to keep it that way, you need to use something like: [icode]gydmas[1].vardas[[B]some_valid_index_here[/B]] = Edit21->Text;[/ICODE]

Member Avatar for En1ro
0
2K
Member Avatar for Black Magic

Sure you can write your C++ code using notepad, it's a text editor after all. But you need to have a compiler/linker to turn the code into a program which you can then run.

Member Avatar for Ancient Dragon
0
249
Member Avatar for jimJohnson

[QUOTE=jimJohnson;596954]the sort from smallest to largest[/QUOTE] See the comment below ... [code]int main() { int count; numbers_used = 0, <snip> // You are passing numbers_used, which is zero, // shouldn't you be using [B]count[/B] instead here? Sort(Size, numbers_used); } [/code] What do you mean by "setting up my widths" ?

Member Avatar for jimJohnson
0
234
Member Avatar for En1ro

In [url]http://www.sqlapi.com/OnLineDoc/index.html[/url] it says that for Borland, the following libraries are available to choose from sqlapib.lib - for linking with release version of dynamic library (Borland C++) sqlapibd.lib - for linking with debug version of dynamic library (Borland C++) sqlapibs.lib - for linking with release version of static library (Borland …

Member Avatar for mitrmkar
0
591
Member Avatar for e_pech

[QUOTE=e_pech;597033]I'm new to C++ with MFC..[/QUOTE] You probably will find the CString class useful. See e.g. the CString::Format() function.

Member Avatar for e_pech
0
167
Member Avatar for Lass

[QUOTE=Lass;597104]how could i arrange the output?[/QUOTE] Use double quotation marks " " instead of ' ', for example; [code] ofile<<patient.name<<[B]" "[/B]<<patient.age<< [B]" "[/B] <<patient.gender<< [B]" "[/B] <<patient.fileNumber<< [B]" "[/B] <<patient.illness<< [B]" "[/B] <<patient.degree; [/code] You can choose the length of the string as you wish. >> but what if i …

Member Avatar for mitrmkar
0
170
Member Avatar for computer engW

I'm trying to point out the errors in your code, so here we go .. [CODE] #include<iostream> using namespace std; int main() { int value,check=1; cout<<"Enter a number: "; cin>>value; while(value>=0) { int newvalue; cout<<"Enter another value: "; cin>>newvalue; if(value>newvalue) cout<<" is increasing"; check=0; [B]// you are not using braces …

Member Avatar for computer engW
0
105
Member Avatar for rem0404

[QUOTE=rem0404;595860]when i run the program and try to add a song, the addsong function always tells me that the item already exists.[/QUOTE] That happens because the logic in [icode]if (titles[i].compare(t_title) && artists[i].compare(a_artist))[/icode] is wrong. std::string::compare() returns zero if the items are EQUAL, so you need to rewrite that comparison. See …

Member Avatar for Lerner
0
127
Member Avatar for henpecked1

Consider the following [code] // A variable of class cdrom on the stack cdrom cdrom1; // invoke the loadinfo() member function cdrom1.loadinfo(); // Allocate a variable of class cdrom on the heap cdrom * cdrom_ptr = new cdrom; // invoke the loadinfo() member function cdrom_ptr->loadinfo(); [/code]

Member Avatar for mitrmkar
0
96
Member Avatar for stevo356

You need to randomize the hillsize and gridref values within the loop in which you initialize the list.

Member Avatar for Ancient Dragon
0
125
Member Avatar for joshmo

>> i defined it in 2 header files but if i take it out from one then it will say S is undefined Define it only once, and use #include "where_S_is_defined.h" where needed (i.e. where you get the 'undefined' error)

Member Avatar for joshmo
0
147
Member Avatar for jimJohnson

There is a mismatch with the Fill_Array() function, prototype is [code]void Fill_Array(int Size[], int& count);[/code] whereas the implementation is [code]void Fill_Array(int Size[], int& count, [B]int& number_used[/B])[/code] In main(), you are using it in the manner which implies that you should remove the 'int& number_used' argument from the implementation.

Member Avatar for Ancient Dragon
0
227
Member Avatar for iamnoangel26

STL's sort() briefly introduced here ... [url]http://en.wikipedia.org/wiki/Sort_(C%2B%2B[/url])

Member Avatar for gazoo
0
215
Member Avatar for Onixtender

You could turn Ancient Dragon's code into a function and then use it to process your input file line-by-line. It could look something like (the function is here AD()) [code] void AD(char * record, char * record_out) { char *p1 = record; char *p2 = record_out; // Rest of the …

Member Avatar for Onixtender
0
150
Member Avatar for Black Magic

[QUOTE=Black Magic;594042]i still get: invalid suffix expected ; before int[/QUOTE] Then you most probably still use there a variable whose name starts with a digit, so please double-check the code.

Member Avatar for Black Magic
0
157
Member Avatar for kbehemoth

Here is one (sort of) short article discussing floating point comparisons [url]http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm[/url]

Member Avatar for Salem
0
154
Member Avatar for David Wang

[QUOTE=David Wang;593702]The red parts are my changes. The last line used to be "this->label2->Text = L"label2";" , showing "label2" in Form2. But my change is not working and got error. I wonder how to fix it. [/QUOTE] What is the error(s) you are getting? Might be helpful to post the …

Member Avatar for mitrmkar
0
300
Member Avatar for NinjaLink

[QUOTE=NinjaLink;593674]Can I get an example of it. Do you mean the "&" sign?[/QUOTE] One example is sumGrades(), inside that function you modify fcounter, mcounter, msum and fsum. However, none of these are passed in by reference (&) so the sumGrades' code does not have the intended impact. So you should …

Member Avatar for NinjaLink
0
86
Member Avatar for kako13

You are doing integer math, change to floating point instead (i.e. from int to double or float).

Member Avatar for kako13
0
290

The End.