Validate Input - C

2432 byte By newbie_in_nc at 2007-11-20 10:37:09
Hoping some one can help. I am writting a programming that needs to test the input to make sure it is numeric. Is there a built in function for this?Here is what I have#include <stdio.h>//Constants#define state1 .0725 //tax for Del Mar#define state2 .075 //tax for Encinitas#define state3 .077...

A weird place

304 byte By leileicats at 2007-11-20 10:37:31
My coding:char* x = "Hello";*x = 'h';cout << *x << ' ' << x << endl;--------------The output is: h HelloWhy the 'H' in "Hello" isn't substituted by the 'h' when I used *x='h'?...

vector of struct problem

785 byte By crzdriver at 2007-11-20 10:37:32
I've been trying and searching all evening on how to make this work, I'm just missing it. I'm trying to figure out how to access the data in a particular vector element once it is passed to the function. If I'm royally screwing this up, feel free to say so. Also, I'm not...

linked list confusion (oop)

666 byte By rcalderoni at 2007-11-20 10:37:33
I need to create a database using a linked list data structure, I want it to be totally object oriented. I understand how a linked list works in theory but in C++ using classes I am kind of confused. Do I need to have two different classes? One that is the list handler and one that is the list items...

noobish question

869 byte By system32error at 2007-11-20 10:37:36
Im quite new at this, anyhow my problem im having is everytime i compile my program and run it it exits once its done displaying its output and it exits fast! heres the source code, im sure its some stupid error im making or a setting within the compiler, oh yeah im using bloodshed by the way. so i...

What am I doing wrong with const

1810 byte By John E at 2007-11-20 10:37:38
Here's a class declaration:-typdef unsigned int timelinePos_t;class TimelineFade{public: TimelineFade(unsigned int start, unsigned int end); virtual timelinePos_t GetStart() { return _startPos; } virtual timelinePos_t GetEnd() { return _endPos; }private: TimelineFade(); timelinePos_t _startPo...

Problem using ceiling function

532 byte By jamtart78 at 2007-11-20 10:37:42
I am compiling some C++, written in Xcode, on the command line but Xcode does not recognise the ceil() function for finding the ceiling of a number even if I include the <cmath> library. The function does not turn blue in Xcode, and g++ gives this error message:"Ceil" was not declared in this...

Resource Script... I need help

270 byte By 7Priest7 at 2007-11-20 10:37:46
I do not have any programs to make a Resource Script...<br/>I dont want any either...<br/>I am using Digital Mars Compiler...<br/>I need a tutorial that tells me how to create Resource Scripts using a plain text editor...<br/>Please and Thank You<br/>Alex

pointer to mu;tidemision array

1649 byte By g3RC4n at 2007-11-20 10:37:50
i want to make a pointer to a 2d array for creating an array at the constructor of a class with the arguments to the class#ifndef MSCLASS_H#define MSCLASS_H#include <vector>#include <ctime>//struct for storing points in a vector//struct __STRUCTTYPEONE__{ int x; int y;}; class mscl...

Adding variable to SQL query (string)

492 byte By sniped22 at 2007-11-20 10:37:58
I have created a basic console app that uses mysql++ to connect to a database.There's more source than this, but this is what is important.string a;cout<<"Enter username: "<<endl;cin>>a;string b="SELECT * from user WHERE user ="<<a;How can I make string b = "SELECT * fro...

[RESOLVED] Quick Question Ascending Order...

868 byte By prof101ar at 2007-11-20 10:37:59
Using only if, else statements without an array, I'm trying to arrange three numbers the user inputs in ascending order. Here is what I have so far:- Get three numbers- Find the first number- I'm having trouble returning to the outerloop to find second and third#include <iostream.h>i...

What is the difference?!

329 byte By Marcham89 at 2007-11-20 10:38:08
What is the diffrence between a free compiler like Dev C++ or Visual Studio Express and Visual Studio? Could you please explain these products do vary price in hundreds of dollars.---------------------------Dev C++ vs. Visual Studio vs. Visual Studio Express------------------...

Javascript and C++

1191 byte By kovacszozo at 2007-11-20 10:38:31
IWebBrowser2* pWebBrowser = NULL;HRESULT comInit = CoInitializeEx(NULL,COINIT_MULTITHREADED);hr = CoCreateInstance (CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER,IID_IWebBrowser2, (LPVOID*)&pWebBrowser);CComVariant url(OLESTR("c:/proba.html"));CComVariant varEmpty;hr=pWebBrowser->Navigate2(&u...

Removing Constness

984 byte By grahamr -work at 2007-11-20 10:38:34
I have inherited a program. Nicely written and const correct.However, the program contains a designer which has guidelines (think architectural drawings). The lines have a value (eventually it is CStatic text, but that doesn't really matter) associated with them.However the value and the lines...

[RESOLVED] What is wronged in this function

1279 byte By Antwerpen at 2007-11-20 10:38:52
Hello, just a fast question.What is wronged in the following function:void writeG(int dim1, DoubleArray & EF,DoubleArray & ET, DoubleArray & g){//function to write g matrix values in a text fileofstream myStream2; // create an ofstream named myStream2myStream2.open("g function.txt"); // associate my...

Admin Superpowers... -

877 byte By .pcbrainbuster at 2007-11-20 10:39:08
Sup people,I've made yet another thread for my own particular reason which came from a big problem I almost had long time ago.One day I downloaded a program and set up its options. Then when I turned on my computer it asked me for a password when I logged in, I was suprised and so started safe...

constructors and destructors problem

556 byte By rag84dec at 2007-11-20 10:39:19
Hi,I the below code i could see 2 constructors and 3 destructors being called...i want to know why...can anyone help me in knowing this?class e{public: e() { cout<<"Contructor\n"; } ~e() { cout<<"Destructor\n"; } void f(e e1) { cout<<"In e\n"; }};int main(int argc, c...

Pointer Passing with a 2D Array

1246 byte By Culperat at 2007-11-20 10:39:24
I'm trying to challenge myself to get a little better at C/C++, but I have a hard time grasping pointers. I'm trying to make a program that takes two nxn matrices, multiplies them, and creates a third nxn matrix. The problem I'm running into is passing the 2D arrays into a method to d...

Linking a file

514 byte By AntonPodolsky at 2007-11-20 10:39:45
I'm trying to follow this tutorial: http://www.codeproject.com/internet/beginningtcp_cpp.aspIt says I have to link my file with libws2_32.a.I am using the next g++ command:g++ test.cpp -l libws2_32.awhich returns: "cannnot find -llibws2_32.a"I also tried compiling the test.cpp into test.o and th...

<< Operator

1912 byte By joebar at 2007-11-20 10:39:46
Hi,I have in a program the following linecout << "Name " << firstName << endl << " Phone " << Phone << endl;where firstName and Phone are strings. That works as expected. Changing it to:cout << "Name " << firstName << " Phone " << Phone &...

questions of vectors in a map

734 byte By damonpeng at 2007-11-20 10:39:58
Dear all,I met a question about using vectors in a map.I defined a structure as followsstruct StrVector{public: CString info; vector<CString> pid;};After that I use a map like this:map<StrVector, int , CStringCompare> myMap;When I try to free the memory using myMap.clear(), it seems tha...

Help with C (new)

2151 byte By mrcizzo at 2007-11-20 10:40:09
I just started taking C classes this past semester and I am having trouble with one of the homework problems I was assigned. Of course I have made an attempt at it but to no avail.I am currently using Visual Studio 2008 Beta and when do "Build Solution" no errors come up at all. When I run the progr...

Help w/ c++ assignment...

1823 byte By GaganW18 at 2007-11-20 10:40:22
Hi all.. I have recently started a c++ class and I need some of your help with...Ive understood all thats required but below is the basic header file for which I will have to create an implementation. I have a stattest.cpp, .h file, & statexam.cpp and am currently working on all the functions. I wil...

string comparison

442 byte By bovinedragon at 2007-11-20 10:40:29
why is this not legalstd::string str = "I am a string";int a=0;while(str[a]!=' '){//store it and do stuffa++;}what is the proper way to do this? in my real code, I am trying to parse a obj file, so I need to break each part apart by the spaces, so I can store the data in my struct. Any ot...

Calling Base class constructor

1337 byte By Rajesh1978 at 2007-11-20 10:40:43
Hi,please see the following scenario.class base{float rate;public:base(){}};class derived : public base{int principal;int year;public:derived(){}derived(int _principal, int _year)//// I am not initializing the base class ////constructor};main(){deriv...

any clue why not writing to file?

2143 byte By WhorlyWhelk at 2007-11-20 10:40:48
I never really used the C way before. Anyways this doesn't give any errors but the file nevertheless remains unchanged. Am I doing something wrong??case IDC_DICT_SAVE: f=NULL; f=fopen("settings.txt","w"); if (f==NULL) MessageBox(NULL,"fnu...

Calling Base class constructor

156 byte By Rajesh1978 at 2007-11-20 10:40:50
Hi<br/>At what cases we need the deep copy and how one can know that at add the class's own copy constructor and assignment operator.<br/>regards.

Name mangling issue..

617 byte By code_carnage at 2007-11-20 10:40:53
Hello Guys, I have come across an issue.. I have a header file lets say.. MyHeader.h It contains a method.. void MyMethod(int a, int b); Now I need to add another argument in the argument list with a default value.. void MyMethod(int a, int b, int c= 10); My question is: Will it not break the existi...

Loading symbols for ntdll

1246 byte By nice_guy_mel at 2007-11-20 10:41:17
Using Visual Studio 6.0 with service pack 6 on Windows XP Pro SP2.I am getting a crash in my program which occurs in ntdll. I have caught the crash in the debugger, but the call stack only has disassembly addresses in it, so I can't get much detail out of it. I heard about how you can integrate...

my program wont end!

8537 byte By muran at 2007-11-20 10:41:18
hey guys. i had to make a basic program where if its an ODD number, then we times that number by 3 then add 1, but if its EVEN number, we divide that number by 2 and if its a 1, then we stop the program.so for example, number 22.. it has 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16,8,4,2,1so this is ca...

Very stange double free issue

2177 byte By Metallion at 2007-11-20 10:41:32
HiI have a dual free issue which is very strange. It looks to me like an object is destroyed and then afterwards we return to the destructor another time. I find this very strange and can't seem to find out why it's happening. Here's the code where it happens.LogicFunction::~LogicFunc...

issue with C++ strings

1111 byte By sathya3110 at 2007-11-20 10:41:38
Hi,I have a requirement to modify c++ objects in a C function. So i have a question regarding this.Suppose there is a string object string str("Hello World"). If i pass the pointer str.c_str() after removing the constness to the function, i am able to modify this successfully. However I am not sure...

Novel Ques: Backdoor Pointer vs. const function

1048 byte By Iman232 at 2007-11-20 10:42:03
Hello,A mystery I have encountered. This is the C++ situation and the problem which is bugging me:I have something like:class Top... operator() const; private: class A; class B;...class A has another operator() method (not constant) which changes its own private variables, while clas...

Bootable CDs -

204 byte By .pcbrainbuster at 2007-11-20 10:42:07
Sup people,<br/>I would like to know how bootable CDs work and what is needed to make them(no programs though, I mean that I don't want to resort to a program to do it for me)? <br/>Thanks.

[RESOLVED] Dev-C++ linker error when compiling DLL

3287 byte By mankku at 2007-11-20 10:42:09
Hi folks!I'm trying to develop an electronic device that is supposed to use the FT232 chip from FTDI to communicate with my PC using USB... I have the UM232R module and I'm trying to establish the communication... The problem is, I want to program the software in C# but need to interface i...

Catching up -

485 byte By .pcbrainbuster at 2007-11-20 10:42:12
Sup humans,As some of you know I was taking a break from school and need to brush up on C++ classes. For now I just have 2 questions -- How would you out put "die now" onto the input stream through a class(the most simplest example shall do)?- Are member functions needed or are they to just make thi...

mouse.event -

332 byte By .pcbrainbuster at 2007-11-20 10:42:13
Sup people,This time I have a question on how to use mouse_event perfectly, I mean I know how to control it but I do not know how to tell it's position on the screen or how to lock from users until its done(meaning people can't move their mouse out the path until the program is done with i...

Issues with template classes and constructors in C++

5200 byte By mgio at 2007-11-20 10:42:17
The following code won't compile under Microsoft Visual Studio C++ and it isn't clear to me why. It will compile under GCC, though. I'm wondering if I have written non-standard C++ or if there is a bug or just insufficient support in VC++. Here is the code:// NullType: Used to signify...

Troule with GetPixel()

794 byte By tobyk100 at 2007-11-20 10:42:19
#include <iostream>#include <string>#include <fstream>#include <cstdlib>#include <iostream>#include <windows.h>int main () { int nXPOS = 1; int nYPOS = 1; std::ifstream myfile; HDC hdc = GetDC(NULL); if (myfile) { std::cout <&...

Reasons for corrupt class member values?

551 byte By goatslayer at 2007-11-20 10:42:29
I am passing a single integer to a constructor function call from another class, for some reason the value is corrupted when a method belonging to that class comes to use it. Has anyone seen this before? - it is also happening when I use more arguments, but thought I'd test with just one.On fir...

char scan

173 byte By Hakan Bulut at 2007-11-20 10:42:48
char narAlfs[] = { "Q","W","E","R","T","J", }; <br/>char *parAlf = narAlfs;<br/>How can easy way char scan no needs to array loop? That is all of char (a-z) scan way to

search an efficient way to handle a long list

929 byte By orunner at 2007-11-20 10:43:00
Hi there, I am using STL and have to deal with many lists (map, vector, etc) which are VERY long. I need to appy filters to a list in some orders and remove them in the reverse order. A filter may allow a certain number of elements to be visible. But there is also a type of filter which disallow a l...

String to character array problem

524 byte By AntonPodolsky at 2007-11-20 10:43:16
I'm writing a program that sends GET requests to a host.The request consists of two parts. The first part is allways the same and the second part changes with each request.Using a string I am able to combine these parts with the + operator:string changingPart="something";string GET="Hard coded...

Code optimization

1086 byte By Jacko123 at 2007-11-20 10:43:18
Hi guys, I have an array of size 10000 bytes. It is declared as extern so that it can be used elsewhere. The memory allocated for the application is 400000 bytes. The code follows:extern int array[10000];//Since array is declared as extern it is used elsewhere //in the programvoid setValue(){ mem...

significant digits in c++

320 byte By bokkamaanus at 2007-11-20 10:43:24
Hello all. I have a question. I am writing a code to calculate some numbers. I need my answers to have only certain significant digits. For example, if I have 99.58765344, I want to to be 99.59 only. I want my answers to have only two decimal place digits, with the last digit rounded off. How do I d...

Why not ++C

206 byte By dave2k at 2007-11-20 10:43:25
We all know preincrement is usually a better option then postincrement, the latter (depending on what type) creating temporary objects.<br/>So why is our beloved language not called ++C?<br/>:lol:

Need help book

224 byte By pbfan at 2007-11-20 10:43:29
I am going to be putting that I know C/C++ on my resume. I have taken a class in it, and I know the basics, (loops, pointers, etc.) however I need a book that will teach me a good amount more. What books would you suggest?

Dynamic Instance Creation

509 byte By joebar at 2007-11-20 10:43:34
Hi,I have a class called QWidgetItem. Depending on user input I have to create a certain amount of instances. I would like to call them item1, item2, ... The problem is that I don't know during compile time how many I need.How do I create an object where the object name, e.g. item<x> has...

Probably very simple

695 byte By Manic19oo at 2007-11-20 10:43:42
I'm trying to create a in game GUI that assigns a vehicle (freeware racing video game) to a team when they spawn. The teams vary from dodge viper to Ferrari diablo. I'm using the torque game engine. In my code, I just set it up for having redteam which I will change later.Here is the code...

Need some ideas...

564 byte By SyrousT at 2007-11-20 10:43:52
Im a new coder. :) Pleased to meet you all! Anyways, Im trying to create a function to change a number to a kind of ASCII picture display for a game. Example:if the number is 1 it would show up | | | |etc. Im stumped atm. lol. Anyone have any hints or nudges that might help me figure...