49,761 Topics

Member Avatar for
Member Avatar for AshfaqueIW

Hi all, I came across some vector problem recently. Below is my code. std::vector<int> MyBuffer(10); for(int i=0;i<10;i++) MyBuffer.push_back(i);//First 10 elements are zero and after index 10 i getting stored. Why the behaviour if like this if i provide size during Declaration. I want to know what will be the difference …

Member Avatar for Zvjezdan23
0
177
Member Avatar for alwaysLearning0

Hi, I was thinking of writing this post as a reply of [URL="http://www.daniweb.com/software-development/cpp/threads/375854"]Need small example for compile time polymorphism and runtime polymorphism in c++.[/URL] But later decided to open this new thread as some expert may want to give some expert opinion on this. On the above mentioned thread, mike_2000_17 …

2
201
Member Avatar for Transcendent

[CODE]#include <iostream> #include <string> #include <cstring> using namespace std; int main() { char name[20]; string lastName; char grade; int age; cout<<"What is your first name "; cin.getline(name,20); cout<<"What is your last name "; getline(cin, lastName); cout<<"What letter grade do you deserve? "; cin>>grade; cout<<"What is your age?"; cin>>age; cout<<"Name: "<<lastName<<", …

Member Avatar for Narue
0
126
Member Avatar for opawix

:twisted: guys can some1 give me hints to solve this? any help will do. thank you. make a program display a lowercase vowels using do while loop: heres my code: [CODE]char letter; { do{ cout<<letter; } while((letter!='b')||(letter!='c')||(letter!='f')||(letter!='g')||(letter!='h')||(letter!='j')|| (letter!='k')||(letter!='l')||(letter!='m')||(letter!='n')||(letter!='p')||(letter!='q')|| (letter!='r')||(letter!='s')||(letter!='t')||(letter!='v')||(letter!='w')||(letter!='x')|| (letter!='y')||(letter!='z')) }[/CODE] heres my code but it won't work!

Member Avatar for opawix
0
144
Member Avatar for 4everct01

I wonder if anyone can help me or guide me the way to remove the vector and subsitute with normal function instead of using the vector reference? [CODE] /*=================main.cpp===========================*/ #include <iostream> #include "Solitaire.h" using namespace std; void HandleMove(Solitaire& game); void HandleMoveToAnswer(Solitaire& game); void ClearScreen(); int main(int argc, char** argv) { …

Member Avatar for iamthwee
0
157
Member Avatar for monika pal
Member Avatar for jonsca
-1
53
Member Avatar for ©lick

Hi. I'm making small application what will do c++ programs compiling easier. I have this code: [CODE]System.Diagnostics.Process.Start("C:\\Alps\\compiler\\H-i586-cygwin32\\bin\\g++.exe", "-c Main.cpp -o main.o ");[/CODE] This code should start [CODE]g++.exe[/CODE] with arguments [CODE]-c Main.cpp -o main.o[/CODE] for compiling main cpp file to o file. Can you see any error in my code? Why …

Member Avatar for ©lick
0
198
Member Avatar for dashure

this is what i have, and i have lots of mistakes in class to class...and friends functions dont know why, need your help CCar.h: [CODE]#ifndef _CCar_H //מונע אפשרות להכללות כפולות של המודול #define _CCar_H #include "CWorker.h" #define LEN_N_FIRMA 20 //class CWorker; class CCar { char m_firma[LEN_N_FIRMA]; // car firma int …

Member Avatar for dashure
0
110
Member Avatar for stonerain

I am trying to use 2 USB webcams with OpenCV. I can get a visual with one webcam but I haven't done with two webcams. Can anybody help me? I use this code for a webcam. [CODE]void WebCam() { char Vid[] = "WebCam"; IplImage * frm; CvCapture * capture; capture …

Member Avatar for Raimucka
0
2K
Member Avatar for Shy01

hello am new here.. can somebody tell me if there's a restriction for a decimal numbers entered? for instance, cout<<"Enter number: " cin>>num; --- if the user put a decimal number on the variable num.. i want this to be INVALID INPUT in the terminal screen as a result. any …

Member Avatar for mrnutty
0
137
Member Avatar for AshfaqueIW

Hi all, I have a switch statement with more than 15 different cases. I want to replace that with any better alternative which would be efficient and also will take less code. I came to know that function pointer can be one alternative. I dont know any anything about and …

Member Avatar for mrnutty
0
1K
Member Avatar for hqt

I am trying to use Code::Block, But I still get some problem like when I'm using DevC++. In Watch Windows, I want to see A array. (example: int A[5][5]). but in debug windows, I will appear from top to down: [CODE]A[1][1] A[1][2] ... A[5][5] [/CODE]This style is to difficult for …

Member Avatar for hqt
0
352
Member Avatar for Labdabeta

I know that this [ICODE]#define QUOTE(X) #X[/ICODE] turns X into a c-string version of whatever is passed to it. my question is if there is a way to do this in reverse ie: [ICODE]#define DEQUOTEANDCALLFUNCTIONORCLASSWITHGIVENNAME(X) (X#)()[/ICODE] is this possible?

Member Avatar for mike_2000_17
1
167
Member Avatar for basement24

Upon building my C++ projects vs2010 crashes even though the process was successful, I tried updating to Sp1 to see if that would fix the problem. But was stopped by some errors on installation. I tried to re-install, safemode, I had some addins about 3, AnkHSVN and two basic other …

Member Avatar for thines01
0
217
Member Avatar for chintan_1671

I migrated the code from C++ to VS C++.Net. I got following error. u.ui2_local = (char *) wcsLocal; u.ui2_remote = (char *) wcsRemote; error C2440: '=' : cannot convert from 'char *' to 'LPWSTR' for both. rc = NetUseDel(NULL, (char *) wcsPath, lForce ? USE_LOTS_OF_FORCE : USE_NOFORCE); error C2664: 'NetUseDel' …

Member Avatar for thines01
0
217
Member Avatar for ztdep

Dear friends: Could you please tell me how to set the tab in vs2008 so as to use multiple rows of tabs in vs2008. I could not fint it in setting. Regards

Member Avatar for jonsca
0
169
Member Avatar for mridontknow

[CODE]#include <iostream> #include <algorithm> #include <vector> #include <string> #include <ctime> #include <cstdlib> using namespace std; vector<string> function1(vector<string>v) { for(int i=0;i<4;i++) {cin>>v[i];} return v; } int main () {vector<string>v; vector<string>guess; vector<string>guess=function1(vector<string>v); cout<<"size:"<<guess.size()<<endl; cout<<"contents:"; for (int i=0; i<guess.size(); i++) {cout<<guess[i]<<"";} cout<<endl; return 0; }[/CODE] i need to build vector<string>guess(4) in function function1 …

Member Avatar for sfuo
0
130
Member Avatar for Mast3r67

Hey guys. I just started to work with SDL few hours ago, and following some tutorials I've managed to make a simple application with a moving image, a background and with a FPS limit. Everything went fine and I've managed to run and compile the program until now. But suddenly …

Member Avatar for sfuo
0
108
Member Avatar for IndianaRonaldo

I have started with windows programming.I am now in the painting and repainting part.When the WM_PAINT is called,the entire client window is supposedly validated,does that meaen the window comes to the foreground and becomes the active one? Or have I misinterpreted the meaning of validation of window? Please help. Thanks …

Member Avatar for caut_baia
0
135
Member Avatar for shbk

does anybody know library for c/c++ to catch pressing of keys like ctrl+shift+foo or fn+f7 etc. ?

Member Avatar for iamthwee
0
94
Member Avatar for Zvjezdan23

This is a class that uses a vector to store 3 points (x,y,z) so i can find the distance from each of the points. Can anyone help me?? [CODE]#include <iostream> #include <string> #include <algorithm> #include <cmath> #include <vector> #define inline using namespace std; int main() { class Vector3 { public: …

Member Avatar for Zvjezdan23
0
155
Member Avatar for watery87

Hi guys, i currently want to replace all spaces into another(or 2) special character, and vice versa. e.g (replacing spaces with 'xx' character and vice versa). Another way would be removing all spaces completely. Is there any method i can use to accomplish that? [code] #include <iostream> #include <vector> #include …

Member Avatar for WaltP
0
120
Member Avatar for fatalaccidents

Hey guys, I'm very new to C++ and had a really quick question concerning linked lists. So I was wanting to pass a linked list to a function. I realize from another post that I need to put void function(Class * & head) to have it actually do something to …

Member Avatar for fatalaccidents
0
106
Member Avatar for AshfaqueIW

Hello all, I want to develop Android java applications for Android Smartphones(>Android 2.1) and Android Tablets(>Android 3.0). I had already downloaded the Latest Android SDK and Eclipse plugin for that. The entire environment for developing the android application is ready with me. I have professional experience of programming in C++ …

Member Avatar for peter_budo
0
176
Member Avatar for Kalpesh_9876543

Hi i am new to c++ i will be needing help so any1 interested in helping me

Member Avatar for ilovec++
-2
157
Member Avatar for hqt

I recently change Code:Block. But I don't know, when I compile, at line 1: [CODE]#define <stdio.h> or #define<cstdio>[/CODE] I see an error:macro names must be identifier. When I compiled on DevC++, I saw no error. the second question I want to ask is, who have link or documents.etc.. that teach …

Member Avatar for sergent
0
172
Member Avatar for Ali BAig

Hi guiz plz some1 help me out . i Am looking to earn some money with the help of my Visual c++ skills

Member Avatar for Narue
-2
44
Member Avatar for winonus

I am trying to write some tool for MSDOS environment but it doesn't work as expected. I want to get the tool to read from some commandline pipe, like C:\> type a.txt|testpipe where testpipe.exe is the compiled program. The problem: After going through the piped contents, it does not stop …

Member Avatar for Narue
0
335
Member Avatar for Gentlevic

please i want to know if its going to be possible for me to learn how to programme a market sellable anti virus, form Gentlevic.

Member Avatar for jonsca
0
86
Member Avatar for winonus

I am using OpenWatcom to code C++ for interest, and I am in search for better compilers. OpenWatcom doesn't have string input and output operators overloaded, I always have to use workarounds. Can anyone name some [COLOR="#ff0000"]standard[/COLOR] compilers which compile and link [COLOR="#ff0000"]pure DOS exectables[/COLOR] for me?

Member Avatar for winonus
0
115

The End.