51,593 Topics

Member Avatar for
Member Avatar for frankleslie8311

// Author: Frank R. Mendez // Title: Object Oriented Calculator Program // Date: 7/13/13 #include <iostream> using namespace std; class Calculator { public: void add(int i, int a); void subtract(int i, int a); void mult(int i , int a); void divide(int i, int a); void modulo(int i , int a); …

Member Avatar for AndrisP
0
6K
Member Avatar for nchy13

This code only print characters until char value is 0 but surprisingly it output characters only upto first blank space. I checked their ASCII values and surprisingly ASCII value of space(' ') character was output by program as 0. I couldn't get it. Any help is appreciated. #include <iostream> #include …

Member Avatar for AndrisP
0
343
Member Avatar for Lp_baez

I keep getting this error on a sample that a c++ book provides. " **error C2660: 'std::vector<_Ty>::empty' : function does not take 1 arguments 1> with 1> [ 1> _Ty=std::string 1> ** ] " I have some suspicious what can be causing the error but I am not sure. the …

Member Avatar for Unimportant
0
298
Member Avatar for christinetom

Hi everyone.. Would anyone know where I could find a good explanation on 'Pipes' in programming. I'm trying to understand how I might go about using input into a GUI application to display output in a dos console. As I understand it, the concept of pipes comes into this somehow. …

Member Avatar for christinetom
0
149
Member Avatar for avinash.jay.7

hi.can someone help me to sort a two dimensional array.. below is how i sort a single dimensional array, i want it in a similar way... im just not good at managing the for loop... single array : #include <iostream> using namespace std; int main () { int M[5] = …

Member Avatar for tinstaafl
0
246
Member Avatar for gerd.brecht.1

ls -1 | grep ".h$" -> searches backwards findfirstchar '.' for file-type h [ C++ Header file ] ls -1 | grep ".cpp$" -> searches backwards findfirstchar '.' for file-type cpp [ C++ Source file ] etc...

Member Avatar for alaa sam
0
83
Member Avatar for ktsangop

Hello everyone! I would like your help regarding this: I have a tuple vector which i must iterate through, and accessing the vector data to decide wether to erase or not the current vector element. My code : typedef tuple <int, CString, int, int> pc_data; vector <pc_data> pc_vec; //Assume that …

Member Avatar for ktsangop
0
6K
Member Avatar for nchy13

I intend to perform in-place modification of std::string with the help of a modifier function. In this regard, I looked up on internet and found that pass by pointer method is not recommended. I have few queries in this regard. * If I pass a std::string to the function as …

Member Avatar for NathanOliver
0
963
Member Avatar for Yashaswi_1

I was using C++. As I was a beginer, I wanted to make some changes in the program. But when I tried doing so, the blinking cursor was erasing the other charcaters. So, can anyone kindly help me out in this problem as soon as possible. I'm in very urgency, …

Member Avatar for Moschops
0
238
Member Avatar for sevin1192
Member Avatar for Lp_baez

I'm trying to create a loop if the string wordEasy contains more than 5 letters. I am using the 'while' and 'for' but none seem to work. I am hopping if you guys would be kind enough to help me figure out what I'm doing wrong. Here is the 'for' …

Member Avatar for David W
0
384
Member Avatar for Lp_baez

Hi everybody, I’m having trouble trying to figure out how to create a loop when the ‘difficulty’ takes a value that is not an integer. I want a player to get the ‘default’ statement presented in the switch . The ‘default’ statement seems to make an appearance but it will …

Member Avatar for David W
0
2K
Member Avatar for pars99
Member Avatar for rubberman
0
252
Member Avatar for sahithi.visvanathan

include a member function named rangeSearch. The function should search the list for a specified range values, defined by two numbers. All value found to be within the range shall be returned a pointer to a list of Nodes in search range. If no value is found, the function should …

Member Avatar for Unimportant
0
208
Member Avatar for Suzie999

A short while ago I was intrigued by a reply made by nullptr in [this thread](http://www.daniweb.com/software-development/cpp/threads/458583/shellexecuteex-api). So I began to look for ways to access the rest of IE (IWebBrowser2) interface, and met limited and varied success. Accessing for instance a <div></div> element in a wep page html document was …

Member Avatar for Suzie999
0
270
Member Avatar for nchy13

Following is the code snippet to override exception::what() function, but what I couldn't figure out how removing const-ness of the function produces following null terminated character string "std::exception". What I could think of is that since exception::what() is const its overriding should also be const. But, even if it is …

Member Avatar for mike_2000_17
0
194
Member Avatar for nchy13

This is a program to reverse the string in place. I have used pass by pointer. Interestingly I have changed the pointer in reverse function which is notable by seeing its output but the pointer which was passed in main function still points to the start of string. This is …

Member Avatar for deceptikon
0
167
Member Avatar for ric24

I want to set a value to a textbox from another class. I have tried to give the GUI as parameter to a function but I can reach it in a .h file, but not in my a .cpp file. Can somebody tell me how it is possible to set …

Member Avatar for Ancient Dragon
0
146
Member Avatar for new_developer

Hi there, I want to know about wchar_t data type i.e. how it is used and why we use it. And also what is the difference between char and wchar_t. One last thing why we write L before wchar_t initialization. #include <iostream.h> void main() { wchar_t w; w = L'A'; …

Member Avatar for deceptikon
0
158
Member Avatar for waqas.zafar.125

Hi there! I have a problem in dealing with dynamic arrays. I have initialized the objects and now i want to print them. My main function looks like this: char* namesList[] = {"Brad Shaw","Aimen Adams","Sal Dimitry","Cristi Anreaz","Poala James"}; int idList[]={232,444,135,52,134}; Team t; Team t1( namesList,idList,5,"waqas"); //t1.Print_team(); My class Team looks …

Member Avatar for David W
0
209
Member Avatar for BobFX

Hi, I'm using a C++/CLI form, with a printDialog item: { public: Form1(void) { InitializeComponent(); this->printDialog1 = (gcnew System::Windows::Forms::PrintDialog()); I call the dialog with: printFont = gcnew System::Drawing::Font( "Courier New",10 ); PrintDocument^ pd = gcnew PrintDocument; pd->PrintPage += gcnew PrintPageEventHandler( this, &Form1::PrintInstPrintPage); printDialog1->ShowHelp = false; printDialog1->Document = pd; System::Windows::Forms::DialogResult result …

0
97
Member Avatar for Labdabeta

I have a program using old data for a game I play to indicate which pixels correspond to the health bar in my game. (my program just loops until a button is clicked and presses a key if the health bar drops too low). Unfortunately the health bar has moved …

Member Avatar for triumphost
0
800
Member Avatar for daniel.mukolwe

write a loop which sums all values between 10 and 100 into a variable called total. assume that total has not been initiated to zero.

Member Avatar for mike_2000_17
-1
57
Member Avatar for nitin1

actually, I was reading C++ from some time , but here i want to learn and imprve my OOPS concepts. IF you have some good links or some e-books or some good book name , please help me here. i have learnt from wiki, my one C book in which …

Member Avatar for soutrik
0
245
Member Avatar for Lp_baez

Hi I learning c++ through a book but I have found that one of the examples provided by the book is an infinite loop. So I was wonderring if anyoone can help me stop it. I tried using the 'break;' statement in every 'for' body to stop the loop but …

Member Avatar for Lp_baez
0
1K
Member Avatar for raging_the_fire

Been stuck on this for bloody ages. Seems like no easy way to do it! Would appricate some help, thanks! #include <stdio.h> #include <stdlib.h> #include <time.h> char (char *s, const int len) { { static const char alphanum[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; "123456789"; for (int i = 0; i < len; ++i) …

Member Avatar for iamthwee
0
3K
Member Avatar for trishtren

Hello, Iv been trying to compile a simple opengl / wxwidgets program in c++ on linux mint. However when i try to compile with : g++ MyGLCanvas.cpp MyGLCanvas.h openGLProjectApp.cpp openGLProjectApp.h openGLProjectFrm.cpp openGLProjectFrm.h `wx-config --cxxflags --libs --gl-libs -lGL` -o simpleprogram I get an error message : cannot find -lwx_gtk2u_-lGL-2.8 collect2: error: …

Member Avatar for trishtren
0
136
Member Avatar for ??!!

1- Write a program that asks the user to input a number of seconds and displays the corresponding time in the form: hours:minutes:seconds. The total number of hours should not exceed 23. Example: if the input is 7275, the output will be: 2:1:15 Hint: if t is the time in …

Member Avatar for tinstaafl
-1
349
Member Avatar for Tony.Z

My code only outputs 0.00 when 'y' is entered. Clearly, I'm a beginner. #include <iostream> #include <iomanip> #include <string> const double ADULTFEE = 18.00, CHILDFEE = 7.50, TRAINFEE = 6.00, BIRDFEE = 5.00; using namespace std; int main () { char reply = ' '; double adultNum = 0, childNum …

Member Avatar for RonalBertogi
0
409
Member Avatar for rofln

Hello. I am currently working on a huffman code program for my class. As of right now, I am currently in the development/debugging stage. I've got the whole thing pretty much covered, but I am having trouble with my tree traversal. I am trying to do an inorder traversal but …

Member Avatar for rofln
0
199
Member Avatar for ms1655516

I would like to end the process. In Task Manager, but it is not the end. So I want a different way. This process changes the port randomly. PID is also random. How to exit from this situation? I need a source to bat. Process Search> PID Search> PID using …

Member Avatar for ms1655516
1
270
Member Avatar for hardus

Hi, I have a little project to do relating picture boxes in visual c++. I have googled for very long and cant find a solution. I have a picture box with 3 buttons, previous, play pause and next. It involves a timer control which will run and enable the slideshow. …

Member Avatar for tinstaafl
0
729
Member Avatar for annitaz

#ifndef LOTTO_H #define LOTTO_H #include <QWidget> #include <QLabel> #include <QTextEdit> #include <QPushButton> #include <QGridLayout> class lotto : public QWidget { Q_OBJECT private: //widget data members QLabel* numbersLabel; QTextEdit* numEdit; QPushButton* lotusButton; public slots: int generateLotteryNumbers (); void displayNumbers(); public: lotto(); }; #endif // LOTTO_H #include "lotto.h" #include <stdlib.h> #include <time.h> …

Member Avatar for plenty.groover
0
285
Member Avatar for mesbahuk

For my **Java to C#** conversion project, I need to use something equivalent to Java's `Calender` class. I have some codes like: Calender cal = Calender.getInstance(); long time = Calendar.getInstance().getTime().getTime(); long time2 = System.currentTimeMillis(); which returns some random values at different times. I have come to know C-sharp's `DateTime` is …

Member Avatar for ddanbe
0
990
Member Avatar for eldiablo1121

hello, I just had a quick question on my program. I'm trying to perform an elevator class program to simulate an elevator that has 3 stops. The only problem is that I can't figure out how my floors increase or decrease, it just increases by one. Here is my code: …

Member Avatar for eldiablo1121
0
223
Member Avatar for waqas.zafar.125

Hi there! I have to read data from a file and load it into an array: here is the data of the text file: Team Creative 6 100 Anwar Khan 201 Belal Ahmed 150 Sara Amjad 400 Nida Khawar 342 Rehan Sheikh 341 Nadia Kanwal My code is: class Player …

Member Avatar for Unimportant
0
192
Member Avatar for Adnan671

Hello. I'm going through LazyFoo.net's SDL tutorials and right off the bat I got stuck. I am using Visual Basic and it is giving me an error saying that the identifier 'args[]' in the main function (line 5) is undefined. Anyone have a solution? //Headers #include "SDL.h" #include <string> int …

Member Avatar for phorce
0
507
Member Avatar for erinkay528

For some reason the program is not reading the if and else statements. Please help The assignment: Assignment: The city zoo charges the fees shown in the table below. General Admission Price Adult $18.00 Child (age 5 to 13) (Under 5 years of age: free) $7.50 Extra Events Train ride …

Member Avatar for Moschops
0
1K
Member Avatar for andrew12s

Please help me to translate this code from c to c++ #include <stdio.h> #include <conio.h> void main() { int n,i,j,a[20][20],ok=1,grade=0,aux=0;ok=1; FILE *f=fopen("c:\graph.txt","r"); fscanf(f,"%d",&n); for(i=1;i<=n;i++) for(j=1;j<=n;j++) fscanf(f,"%d",&a[i][j]); fclose(f); for(i=1;i<=n;i++) if(a[1][i]==1) grade++; for(i=1;i<=n;i++) { for(j=1;j<=n;j++) if(a[i][j]==1) aux++; if(aux!=grade) ok=0; aux=0; } if(ok==0) printf("graph is not regular."); else printf("graph is regular."); getch(); clrscr(); …

Member Avatar for rubberman
0
293
Member Avatar for strRusty_gal

int index = 3; map<int, Class> list; std::map<int, Class>::iterator test = list.begin(); std::advance(test, index); for(map<int, Class>::iterator it = test; it != list.end();++it) { cout << it->first << " " << it->second.GetPrice() << endl; } Hi Everyone, Please help me on this issue. I know how to start at a certain …

Member Avatar for vijayan121
0
207
Member Avatar for avarionist

I spent about an hour or so googling but no luck. I want to program for hardware(which apparently people seem to think is obsolete for some reason) however i can find no tutorials on it period i suppose i could always use Assembly but my knowledge isn't that great. Is …

Member Avatar for DeanMSands3
0
3K
Member Avatar for DavidB

Here is a small--complete--program that includes a sub-routine that inputs two matrices and then multiplies them. Notes: * 1) I happen to like taking input from a text file. It eliminates the need to type input from the console, especially when debugging, it prevents the possibility of making typos. * …

Member Avatar for Shellback3
3
2K
Member Avatar for andrew12s

I am a beginner with programming and I really need to resolve this problem. So, I need to implement the following class that represents this type of crowd and operations with those : class Crowd { int* element; int number; public: Crowd(int m_number, int* m_element); Crowd(Crowd&); ~Crowd(); Crowd& operator= (Crowd& …

Member Avatar for rubberman
0
148
Member Avatar for arunkishorres

i want to read text between two indices in the file usinf file i/o operations in c++. HOw ca i do it? for example, here is the text file: 1: .. .. 2: .. .. 3: .. .. 4: in this text file i need to print only the lines …

Member Avatar for deceptikon
0
240
Member Avatar for frankleslie8311

//Author: Frank R. Mendez //Title: Insertion Sort //Description: Accepts int elements and stores it in an array list then sort every element in accending order //Date: 7/13/13 5:53 PM #include <iostream> using namespace std; class Sort { public: void insertionSort(int x[],int lenght); void driver(); void display(); int arr[15]; // because …

Member Avatar for kvahanyan
0
2K
Member Avatar for Suzie999

I'm trying to embed a window into my own. I somehow new it would not be as simple as it sounded, so I'd like a pointer where else to look if anyone can help. hMyOwnWindow //HWND hExternalWindow // HWND //size the external window so it will fit. MoveWindow(hExternalWindow,19,102,383,400,true); //set style …

Member Avatar for Suzie999
0
4K
Member Avatar for soche123

I don't get what this error mean in line 17 or 18.. #include <iostream> #include <conio.h> using namespace std; int main() { int players; int years=3; cout<<"Enter no. of players"; cin>>players; int record[players][years]; for(int i=0; i<=players; i++) { for(int j=0; j<=years; j++) cout<<"Enter runs scored by player"<<":"<<i+1<<": "; cin>>record[i][j]; } …

Member Avatar for rubberman
0
1K
Member Avatar for Matthew_2

I have posted this on GBA temp ([here](http://gbatemp.net/threads/garbage-on-top-of-screen-when-displaying-text-over-background.350999/)) without any replies: Another newb question.. I am currently using the 16-bit libnds example (Located within [here](http://sourceforge.net/projects/devkitpro/files/examples/nds/)) as a basis and am trying to display text and the png background image on the same screen (in this example it is the top …

Member Avatar for Matthew_2
0
185
Member Avatar for laurel.jackson.12

This first code is to go to form5 private: System::Void btnSend_Click(System::Object^ sender, System::EventArgs^ e) { MessageBox::Show("Updated task was sent to project manager."); Form5^ f5 = gcnew Form5(); f5->ShowDialog(); } But I thought it would be the same thing of I want to get back to form4 while I'm on form5 …

Member Avatar for Ancient Dragon
0
145
Member Avatar for laurel.jackson.12

#include <iostream> using namespace std; int main () { //declaring variables double Pi= 3.1416 ; double Diameter_ofcircle = 0.0; double priceofrailingmaterial = 0.0; double Totalpriceofrailingmaterial = 0.0; //Getting the user input cout<<"Enter the diameter of the circle "; cin>>Diameter_ofcircle ; cout<<"Enter the price of railing material per foot "; cin>> …

Member Avatar for laurel.jackson.12
0
302

The End.