51,593 Topics

Member Avatar for
Member Avatar for CoolGamer48

Is it bad to make a reference parameter optional by giving it a default value? Like here: [CODE]int Parse(std::string filename, std::string& error = (std::string)"");[/CODE] Here, the caller of the function may pass an optional std::string that will be filled with an error message if there is one. Is this considered …

Member Avatar for Duoas
0
106
Member Avatar for supersoup

in more basic C++ terms what does the following code mean? [CODE]friend ostream& operator << (ostream& os, const item* itm);[/CODE] it is a function in a header file

Member Avatar for Duoas
0
106
Member Avatar for QuantNeeds

Hello, My code works but I would like to adjust it to perform better. My teacher would like me to perform quickSort with pointers. I did use them but I was wondering what else I could change to improve the usage of pointers? For instance how can I pass pointers …

Member Avatar for Alex Edwards
0
70
Member Avatar for QuantNeeds

Hello, I was wondering how I could correct this. It is referring to the following line: [code] set.quickSort(prt1, 0, arraySize-1); [/code] I tried to create an object and call the function this way but I am not sure how to correct this error. My code is the following: [code] bool …

Member Avatar for QuantNeeds
0
179
Member Avatar for TheWhite

Hi. Well, the past year, I have spent learning GUI programming in Java and have created several games (Asteroids, MineSweeper, TicTacToe, etc, etc) in Java. I was wondering if there is an easy way (is it easy at all?) to go from what I know about GUI programming in Java, …

Member Avatar for TheWhite
0
688
Member Avatar for Nemoticchigga

I have a vs2005 forms app, I have added a header file with a bunch of functions, but now i get a bunch of LNK2005 errors, one for every function. How do I resolve this? Do I need to put them in a class? Thanks.

Member Avatar for Salem
0
86
Member Avatar for n.aggel

Hi guys, i have one question regarding alignment. Assume that you have the following struct: [code=c] struct align1 { double a; char b; int c; short d; }; [/code] Also assume: sizeof(double): 8 sizeof(int): 4 sizeof(char): 1 sizeof(short): 2 i would expect: sizeof(align1): 8 + (char padded to->) 4 + …

Member Avatar for n.aggel
0
175
Member Avatar for DonkeyKong92

Does the infomation make a differance to the programs speed? [CODE]// Operating with hello world #include <iostream> using namespace std; int main () { // Print out the result: cout << "Hello World! "; cout << "This is my program"; // Keep program running: cin.get(); //Terminate the program: return 0; …

Member Avatar for DonkeyKong92
0
195
Member Avatar for KenTheFurry

Well I am writing a little message encryption program (simple) and Well it works but it will not change anything after a space. just hoping someone here could help. [CODE] cout << "Enter in the message you want to encrypt..." << endl << " "; cin >> in; count=strlen(in); for(i …

Member Avatar for KenTheFurry
0
160
Member Avatar for originaldaemon

I have created a new windows form application and made a form using the editor in visual studio. This is the code that was generated in form1.h: [CODE]#pragma once namespace DatabaseForm { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; …

0
51
Member Avatar for gispe

hi ppl, i' ve done a program that calculates the result of raising a random base to a random exponent. the problem is that this stays in a loop that never comes out, n i have to abort it. and, its ok to put `exp*=exp??` cuz, i dont know how …

Member Avatar for gispe
0
73
Member Avatar for faisaly

Dear All, Kindly tell me in brief that " impct of OO paradigm on software development (programming)"

Member Avatar for Narue
0
258
Member Avatar for TeCNoYoTTa

hello all i want to know the uses of function returning by refrence and how to use them i tried this but it gave an Error [code] int& sumz(int x,int y) { int *sum = new int; *sum = x + y; return sum; }[/code]

Member Avatar for Alex Edwards
0
110
Member Avatar for amt_muk

Hello friends, Suppose I have a .doc file (MSWord). Now, how can I read that file using C++ console application, ie, not using MFC or any other visual components. Thanks, Amit

Member Avatar for marco93
0
76
Member Avatar for karang

Hi I have made a program that will change the settings of printer orientation. But I am getting linker error. " [Linker error] undefined reference to `OpenPrinterA@12' " I am not able to find out the reason. Kindly advice Regards Karan Gupta

Member Avatar for Ancient Dragon
0
540
Member Avatar for buddy1

I have a recursive function squares that receives a positive integer n and prints out the first n perfect squares in descending order. Can anyone tell me if this is correct and if not please help. [ICODE]squares(int n) { if( n== 1 ) return 1; else return squares ) n …

Member Avatar for buddy1
0
100
Member Avatar for buddy1

BinarySearch is called on the array below, searching for Value 20. Is the final value of Index 20 in [6]. I think this is right. 2 5 10 15 20 20 20 20 [1] [2] [3] [4] [5] [6] [7] [8]

Member Avatar for buddy1
0
78
Member Avatar for kartik14

Hi, Is there any way to store huge numbers (for example, a number with a million digits) in a C program and be able to perform operations on it ? Thanks..

Member Avatar for ivailosp
0
70
Member Avatar for Hannahlv

Hi, everyone! I thought I posted the code first, it's better. This is the code of the program I've worked with : [CODE] #include "liveMedia.hh" #include "BasicUsageEnvironment.hh" #include <stdio.h> UsageEnvironment* env; Boolean reuseFirstSource = False; Boolean iFramesOnly = False; static void announceStream(RTSPServer* rtspServer, ServerMediaSession* sms, char const* streamName, char* inputFileName); …

Member Avatar for Hannahlv
0
232
Member Avatar for aecsant

How can I achieve in c++, like Foo foo = new Foo.SubFoo(); or Foo foo = new Foo().SubFoo(); Where, Foo : class SubFoo: maybe sub class or independent class, but not method. Note: i Donโ€™t want to use "namespace"

Member Avatar for Prabakar
0
261
Member Avatar for Christian2011

Hi Quick questions abour overload constructors. Lets say I have two overload constructors: [code=c++] class MyFileExtractor{ MyfileExtractor(string); MyfileExtractor(string, int); ~MyfileExtractor(); private: string name; int columns; } /*Class implementation*/ MyFileExtractor::MyFileExtractor(string fname,int c):columns(c) { name=fname; } MyFileExtractor::MyFileExtractor(string fname) { #define STD_NUMBER_OF_COLMS 1 //standard number of columns MyFileExtractor::MyFileExtractor(fname, STD_NUMBER_OF_COLMS); } MyFileExtractor::~MyFileExtractor() { cout …

Member Avatar for Christian2011
0
2K
Member Avatar for Jennifer84

I have started out with tasks that need to communicate between different forms. I need to understand the logic how this works and have problems to find any examples of this. For the 2 codeexamples below, I use these to close the current Form or activate another button on the …

Member Avatar for Jennifer84
0
225
Member Avatar for cam875

Hello, I am having a small problem because I have to have to have it so the user can enter a number and that number is stored in a variable and that variable becomes the name of the file to be created with the extension .asw. It is going to …

Member Avatar for cam875
0
102
Member Avatar for Lukezzz

I have a 2D vector that I have a count on the first dimension and push_back for the second dimension. The vector i have declared like this: [code] std::vector<std::vector<string> > TwoD(1000, std::vector<string>()); [/code] For example say that I have counted the first dimension to 3 and push_backed the second dimension. …

Member Avatar for ArkM
0
209
Member Avatar for xyzt

hello, i want to learn if there's memory leak problem in my code...Let me explain: I have a Customer class,that class also have a destructor function. I have a static function in that class which returns n Customer objects. [CODE] static Customer* createCustomers(int n){ //... } [/CODE] [CODE] int main(int …

Member Avatar for Ancient Dragon
0
134
Member Avatar for Gromnie

my 2nd prog, i intend on adding to it next so that it manipulates the data, see what cool things i can make it do....anyways, just looking for some feedback again on my prog, does it suck :) ? Thx in advance [CODE]#include <iostream> #include <fstream> #include <vector> using namespace …

Member Avatar for Duoas
0
100
Member Avatar for henpecked1

My professor has assigned a lab that we will later be using to learn how to abuse the various types of data structures. In this first lab he asks for the default constructor, a copy constructor, and an overloaded constructor to accept the appropriate data, which you'll see in a …

Member Avatar for Duoas
0
134
Member Avatar for chaoticabyss99

I'm having trouble with an inheritance hierarchy program. I have widdled this program down from a lot of errors to just 1 error. However, I can't seem to figure out how to correct it. Here is the error message I'm receiving: [code]error C2679: binary '<<' : no operator found which …

Member Avatar for chaoticabyss99
0
255
Member Avatar for Shadoninja

I know that to make a simple yes or no question I can do this: [code] int Answer; cin >> Answer; if (Answer == 1) { Response } else { Response } [/code] But in the accounting program (In a recent thread), it registered the key before you hit enter. …

Member Avatar for Shadoninja
0
88
Member Avatar for TheBeast32

Hi, I have been making a program that encrypts files. It works, but it compresses them. It only does it a little bit, but it does. It's weird. Why is it doing this? I have attached a zipped folder with the code, binary, an encrypted file, and the original file. …

Member Avatar for aminit
0
80
Member Avatar for almon

I am new to both c#.net and sql server. I am working on a project in which I have to 2-3 users using their application and connecting to common database in lan. I decided to use c# as my programming language. when coming to database i m very confused. microsoft …

Member Avatar for Ramy Mahrous
0
104
Member Avatar for shariff089

hi every one Im still new to programming i have downloaded borland compiler and was writing the following code: [code]#include<iostream> using namespace std; int main() { for (int x = 0; x < 10000000000; x++ ){ cout<< x << endl; }cin.get(); }[/code] the problem is that when it is done …

Member Avatar for VernonDozier
0
128
Member Avatar for Jennifer84

I am writing an interpreter and have come that far that I need to identify or-stataments( || ). Just for fundamental analysis. The code is not a problem. Only the thinking here. My problem is that I am not quite sure how I have to think. I know how it …

Member Avatar for Jennifer84
0
340
Member Avatar for fedderico10

Hey! how is everybody! I need help on my little home project. how do i write a for with no limit of iteration? i need it to stop when a value into the for is reached not when i<=n.

Member Avatar for ArkM
0
104
Member Avatar for Emerald214

I am trying to finish it but there is a problem. The overloaded operator>> doesnโ€™t work in class Circle. Would you please explain to me what wrong thing I did? Thank you so much. [code=C++] #include <iostream> using std::cout; using std::cin; using std::endl; using std::istream; using std::ostream; #include <iomanip> using …

Member Avatar for ArkM
0
178
Member Avatar for 11silversurfer1

Hi I am having great trouble with making my bitmap fit properly on a 1024x768 full screen window. The length is correct but the vertical is too long. I have searched the net and it has said that the size goes up in squares eg 2, 4, 8, 16, 32, …

Member Avatar for 11silversurfer1
0
474
Member Avatar for asad12

i am having a problem in my function, i need someone to explain or fix my problem. and r my arrays correct. [code] #include<iostream> #include<iomanip> using namespace std; void display_draw(int mega[12][6], int draw_index); int main() { //int i; const int NUMROWS=12; const int NUMCOLS=6; int draw_index; int val[NUMROWS][NUMCOLS]={ 5,14,16,39,51,34, 1,20,22,29,41,35, …

Member Avatar for ArkM
0
109
Member Avatar for Dannyo329

Well. I 'm trying to get a program in C++(MS-DOS) to open another .exe file. I thought there might have been a way with the: [CODE]system ("main.exe") ;[/CODE] to call it, but somehow it does not work and its like it skips it completely. I'd appreciate any help. Thankyou. (Sorry …

Member Avatar for Duoas
0
4K
Member Avatar for greyghost86

In the code below i can'f figure out how to get the numbers from my inFile that will be reversed then put into my outFile. I left part of the code unfinished. not sure what I am supposed to put in between >> >>. pretty lost on this one. Im …

Member Avatar for Duoas
0
119
Member Avatar for carlos_lopez_m

Hi everyone! I have a program written in C++ which already exports some data to Excel, on the other hand, I have another program written in VBA to analyse the data. I used to run them independent but now I would like to simplify them. Is there a chance to …

Member Avatar for carlos_lopez_m
0
160
Member Avatar for hiddendragon

u ask user for the filename and then u read the the file, display it into an array assume file contain only numbers with that u display data such as total,average,highest number,lowest ect.. my question is how would u determine the size of an array to work with?? given the …

Member Avatar for hiddendragon
0
147
Member Avatar for Code Shark

Hey. I am wanting to make this program so that the user can move the position of his characters. I have made a attempt but i am confused about some bits. [CODE=C++]// Code Shark #include <iostream> using namespace std; int main() { char character = 'X', movement; do { system("Cls"); …

Member Avatar for VernonDozier
0
151
Member Avatar for Alex Edwards

How in the hell do you divide by 7 using nothing but-- ~, ^, >>, <<, &, | -- In a set algorithm. I'm stumped. I've tried mapping out different numbers dividing by each other... it didn't work. I would map out a number subtracting from the other to see …

Member Avatar for invisal
0
176
Member Avatar for wtf???

how would i write code so when someone enters 1 charcter it changes it to somthing else for example if someone entered 100 / 5 it would say 100 รท 5.

Member Avatar for ctrl-alt-del
0
95
Member Avatar for Evan M

I've been getting an "Access Violation" error while running this program: [code=c++]#include "SDL/SDL_ttf.h" class Font { private: TTF_Font *font; public: Font() { font = TTF_OpenFont( "c:\\windows\\fonts\\cour.ttf", 20 ); } ~Font() { TTF_CloseFont( font ); //Access violation } }; int main( int argc, char *args[] ) { if( TTF_Init() < 0 …

Member Avatar for Evan M
0
237
Member Avatar for Fault

Hey i have a few random questions that i can't seem to get my head around at the moment. Any help would be appreciated 1) What criteria would you apply in deciding which of the three forms of loop to use in a program? 2) What does this function prototype …

Member Avatar for tecktalk
0
124
Member Avatar for Code Shark

Hello, I made this program that has random values and you have to choose to say if the next number will be higher - or lower. I completed the code and successfully had no errors but when the user is mistaken nothing comes up. Am I missing something? [CODE=C++]// Code …

Member Avatar for VernonDozier
0
146
Member Avatar for fittipaldi

Board.cpp: [CODE]#include "Board.h" Tetris_::Board::Board(int b, int h) { width_ = b; height_ = h; } ostream& operator<<(ostream& out, const Tetris_::Board& brd) { out << "(" << brd.width_ << ")"; return out; } Tetris_::Board::~Board() {}[/CODE] Board.h: [CODE]#include <iostream> #include <stdlib.h> using std::ostream; namespace Tetris_ { class Board { public: Board(int b, …

Member Avatar for Narue
0
86
Member Avatar for Q8iEnG

Hello :) Umm I have a small question :) Which do you recommend for fast searching BST or AVL tree? My answer: It might be the BST because it'll be noticed that in the right subtree all the numbers greater than the root will be there also for the smaller …

Member Avatar for Q8iEnG
0
130
Member Avatar for farooqaaa

The End.