49,760 Topics

Member Avatar for
Member Avatar for chchiu
Member Avatar for mrboolf
0
125
Member Avatar for Shinedevil

I need to find out, because my program deals with numbers, how to block characters from being inputted. Such as, [code] int input; cout<<"Please type in a number."<<endl; cin>>input; //input should be a number. A letter? Oh no. [/code] if the input would have been a character, BOOM! Program == …

Member Avatar for StuXYZ
0
182
Member Avatar for abhijitm

Hi In the below code , i am getting compile time error when declaring the copy constructor . C:\work\Dev-Cpp\bin>"mingw32-c++.exe" dynamicArray.cpp dynamicArray.cpp:13: error: expected `,' or `...' before '&' token dynamicArray.cpp:13: error: ISO C++ forbids declaration of `dynarrray' with no t ype dynamicArray.cpp:13: error: `dynarray::dynarray(int)' and `dynarray::dynarray(in t)' cannot be overloaded …

Member Avatar for abhijitm
0
144
Member Avatar for sid78669

I have a very similar issue. I am also doing and assignment and needed a function grow. This was to increase the size of the object array Savings by s, if it was not NULL, or make its size s if it was null. In both the case it was …

Member Avatar for ArkM
0
140
Member Avatar for koushal.vv

Hi All, i have a problem in converting CString to Int/Double, function i am using is _wtoi , _wtof..... Here if the CSting value has say "12345" this works perfectly. But if any other value is say ( Over flow ) " 11111111111111111111111111111" which exceeds the max size of int …

Member Avatar for koushal.vv
0
228
Member Avatar for littlestone

Does it need a copy constructor and an operator= for a class which have array member? for example: Class A { private: B data_[100]; //B is a class }; does class A need a copy constructor and an operator? in other words, is the default copy constructor is OK for …

Member Avatar for abhijitm
0
208
Member Avatar for drjay1627

I have string and a map<string,int> i need to iterate through the map and find string[i] and replace the int with the string. eg: if map contains hello 6 world 4 its 3 me 60 if the string is "its me hello world world hello" output should be "3 60 …

Member Avatar for ArkM
0
125
Member Avatar for AutoC

I have a c++ program that performs a functionality. generate.h [code] struct code { bool out; bool *reg; }; class Cyclic { private: struct code *cy; int rgsize; bool *gen; int gensize; unsigned short cycodes[256]; public: Cyclic(int a, int b,bool c[]); void leftShift(); bool* cyclicCode(bool mssg[],int msize); void printReg(); bool* …

Member Avatar for ArkM
0
224
Member Avatar for xinix

Hey all, I posted a question earlier this week regarding dev-c++ and my inability to keep the output window (#include <iostream>) open long enough to see my program running! I have already tried the following things and would be grateful for any other suggestions! 1: (Without typing using namespace std;) …

Member Avatar for VernonDozier
0
1K
Member Avatar for abhishek.com

Hi Guys I have a query regarding "sizeof" operator and it is related to the program: [B][COLOR="Red"]{ int x; x=sizeof (-32768); printf("%d",X); getch(); }[/COLOR][/B] Then it's printing it's value as [COLOR="Red"]4[/COLOR], But logically it should be[COLOR="Green"] 2[/COLOR] because the integer range is from -32768 to 32767. ============================================== [B]And my second …

Member Avatar for vmanes
0
119
Member Avatar for solimanmuttawa

this is a linked list assigment and the required from me is to fill the functions: i have one fucntion left that i was unable to do which is void DeleteElement(int ID); and i have another problem the compiler states that i hve o errors but when i compile the …

Member Avatar for Lerner
0
88
Member Avatar for bombe

Hi viewers, I was trying to delete a file from my hard drive and I don't really have a good place to start. I googled it and came up with a code derived from multiple sources. I was wondering if anyone could help me out with the code to delete …

Member Avatar for permoda
0
118
Member Avatar for robgeek

I am trying to read a file from fstream in a switch statement but something in the code seems to be stopping this part of my code to be read by the compiler. Please some one let me know what am I doing wrong. Its not the text file thats …

Member Avatar for robgeek
0
252
Member Avatar for preet4fun

i nees to make a function to output students name in the form last name followed by a comma followed by a space followed by the first name and the name must be left justified than next to it need to print the student score and student grade like this: …

Member Avatar for Lerner
0
86
Member Avatar for jimbob90

[code=c++] 4 char *min(char *a, char *b, char *c){ 5 if(strcmp(a,b) > 0) && (strcmp(a,c) > 0) 6 return a; 7 else if(strcmp(b,a) > 0) && (strcmp(b,c) > 0) 8 return b; 9 else 10 return c; 11 } [/code] Code won't compile and the irony is i just did …

Member Avatar for ArkM
0
3K
Member Avatar for valluvanl

Is it possible to call a void function from another void function? will this work? [code] mainMenu() { int input; cout<<"\t\t Main Menu \n\n"; cout<<"\t\t 1. Student Details \n"; cout<<"\t\t 2. Payment Details \n"; cout<<"\t\t 3.Exit \n\n"; cout<<"\t\t Select 1/2/3 : "; cin>>input; if(input==1) { void studentDetails(); } if(input==2) { …

Member Avatar for valluvanl
0
119
Member Avatar for Jason123

I have classes with inheritance (for now only Car, more to add on like Bus, Truck etc) and adding to list. 1) How can i display using the subclass display function? 2) Can list<Vehicle> list be in a class? [code=cpp] #include <iostream> #include <list> using namespace std; class Vehicle { …

Member Avatar for ArkM
0
88
Member Avatar for MosaicFuneral

Here's what I'm trying out: [icode]Substitute characters into values with no set left bits; check if the next position is a vowel(or whatever), turn it into a value with no right bits set, join the two characters into a single byte, delete the unused position now.[/icode] Here's the code using …

Member Avatar for MosaicFuneral
0
281
Member Avatar for Majestics

[code] Apply all steps of conceptual and logical database design on the following requirements: The system should be able to store a customer’s name, address, and contact information and a book’s ISBN, publisher, authors, and title information. A customer should be able to purchase one or many books at a …

Member Avatar for Majestics
0
101
Member Avatar for rumencho

Hi all. When I create simple console application with Visual Studio C++ ,and I run it, my program shows on full screen, How to adjust my .exe files to show on single console window?

Member Avatar for ArkM
0
94
Member Avatar for rtmarch

so i have been sitting here for about 2 days finishing this thing and i still have one error left and i am having a hard time fixing it 1>k:\c++\energy bill part 3\energy part 2.cpp(119) : error C2059: syntax error : ';' here is my code thanks for your help …

Member Avatar for TheBeast32
0
121
Member Avatar for AcidG3rm5

Hi all. I was writing my program. And halfway through, i tried to compile and run. but got a blank output. I tried doing a cout<<"hello"<<endl at the main() must still didn't get any display. could anyone please help me to see what went wrong? [code=cplusplus] #include <iostream> #include <fstream> …

Member Avatar for Ancient Dragon
-1
122
Member Avatar for knharp3

[code] #include <iostream> #include <cmath> using namespace std; int main () { float leg1, leg2, hyp; cout << "Enter one leg "; cin >> leg1; cout << "Enter one leg "; cin >> leg2; if ((leg1 < 0) || (leg2 < 0)) hyp = 0; else hyp = (sqrt((float)leg1*leg1 + …

Member Avatar for ArkM
0
138
Member Avatar for vatsa.devil

getting straight to the point, my program compiles fine.. it shows 0 errors and 0 warnings... but when i run my program, it just crashes.. u know the usual dialog box with buttons like send dont send and debug.. .. here's the code.. [CODE] // include the basic windows header …

Member Avatar for jbennet
0
209
Member Avatar for mrboolf

Hi all there. I was given the task to implement a Subset class with a few function. It should be structured so to contain the original set and make it possible to generate all subsets. Right now I'm focusing on the "generate all subsets" part. I've done a little searching …

Member Avatar for mrboolf
0
733
Member Avatar for cristinel

Hello, I have a problem creating a template class with copy ctor and cast operator to class of base template (using gcc 4.2). The program compiles if only one of them is defined but is not compiling if both (copy ctor and cast operator) are defined. The compiler error is …

Member Avatar for cristinel
0
184
Member Avatar for SlayerX

Need some help on text file compression.... Text File Compression. The text file compression must be able to perform the following functions: • Able to compress a text file and generate an index file • Able to decompress the file • Able to show the time taken for compressing and …

Member Avatar for Salem
-1
309
Member Avatar for Stefano Mtangoo

Hi All, For long now have tried to get Python bindings and none is there. jlgm suggested me to try ctypes and I dived in. But there are few examples on using ctypes for new bees like me. I tried to take lame_enc.dll (The file made me to learn ctypes …

Member Avatar for Stefano Mtangoo
0
867
Member Avatar for bradbobak

This is my example code: [code] #include <vector> std::vector<int> v; int main(int, char **) { std::vector<int>::const_reverse_iterator iter = v.rbegin(); if (iter != v.rbegin()) // or v.rend(), whatever, just problematic { } } [/code] Is this supposed to compile correctly? Using g++ 4.2.4 it does. Using [quote]sbox-i686-linux-gcc (GCC) 3.4.4 (release) (CodeSourcery …

Member Avatar for bradbobak
0
123
Member Avatar for Superstar288

hey everyone im making an gui in C++ which needs to retrieve windows registrys such as windows version etc. however im stuck on some code i was hoping for some help please. [CODE] void GetSystemInformation(void) { float fprocessor; HKEY hKey; DWORD processorspeed; DWORD datasize; RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Hardware\\Description\\System\\CentralProcessor\\0",0, KEY_QUERY_VALUE,&hKey); RegQueryValueEx(hKey,("~MHz"),NULL,NULL,(LPBYTE)&processorspeed,&datasize); fprocessor=float(processorspeed); if (fprocessor>1000) …

Member Avatar for dougy83
0
153

The End.