51,593 Topics

Member Avatar for
Member Avatar for nekoleon64

My name is Leonard E. Norwood Jr. I'm just practicing a simple bubblesort program but this time using classes and pointers with operators >> and << and also an overloaded operator =. I'm merely trying to sort a list of numbers from lowest to highest. And the purpose of the …

Member Avatar for nekoleon64
0
249
Member Avatar for mattster

Hi all, Am building a WinAPI project in Code::blocks and MinGW. I Downloaded some opensource source code, and tried to compile the snippet haveing done nothing to it, and I get *Syntax Error on line 6* for the following code: IDR_MENU MENU DISCARDABLE {//BEGIN POPUP "File" {//BEGIN MENUITEM "New", IDM_NEW …

Member Avatar for mattster
0
330
Member Avatar for v_janssens

Hi there, I'm a Visual Basic novice and have written a very simple GUI which I want to use to run a c++ program. I'm wondering how I would write the button click event to call the C++ program? I assume there's probably a simple way to do this but …

Member Avatar for jean1234
0
364
Member Avatar for Magic681

Hey guys, so I'm trying to make a Paper, scissors, rock program (where you play against the computer). And i got pretty far, to the point where it seemed finished. But then i realized that i need to make the program exit itself after the player wins three times. So …

Member Avatar for Magic681
0
420
Member Avatar for ariel930

Hello again.I recently have been doing a assignment which asks us to write a function to check whether a tree is perfectly balanced.I know the concept of Perfectly balanced tree but I just cant make out how to write this function.Any help in right direction will be highly welcome.

Member Avatar for yde
0
877
Member Avatar for GolDRoger00

i read from a file okay for each line i save the respective data into their respective variables i output each variable to see if the data has really been saved.(is has) but when i try using the if condition to check the variable and perform a function it doesn't …

Member Avatar for Ancient Dragon
0
127
Member Avatar for mohamed.rani

want to change all printf to cout with keeping the same output #include <iostream> using namespace std;Heading Here void main() { unsigned int a,b,c; char*format1 , *format2; format1 = "%04x%s%04x=%04x \n"; format2 = "%c%04x=%04x \n"; a = 0x0ff0; b = 0xf00; c=a>>4; printf (format1,a,">>",4,c); c=a&b; printf (format1,a,"&",b,c); c=a|b; printf (format1,a,"|",b,c); …

Member Avatar for Ancient Dragon
0
172
Member Avatar for new_developer

Hi there, Please check my program. When i compile it i am getting error. Cannot find default constructor to initialzie base class. #include <iostream.h> #include <conio.h> class Parent { protected: double num; public: Parent(double n)  { num = n; } void sub() { num -= 2.0; cout << "num …

Member Avatar for NathanOliver
0
342
Member Avatar for ucvx32

Hello I am really scratching my head around this ,i want to create a class function with more than one option Someathing like I don't really know for what to look for (basically a class whithin a class whithin a class and so on)... so i'll give an example: Events.add.coord(); …

Member Avatar for ucvx32
0
134
Member Avatar for Ben Ashton

Hello I am slowly learning more and more about C++ and more importantly programming technique and I have reached the wall that I am sure quite a few before me have probably hit - refrences/pointers and management of the heap. Whilst I try and familiarize myself with the above, I …

Member Avatar for Ben Ashton
0
119
Member Avatar for ruzzy

hi plz try to solve method of deduct fees that chrges$2.5(using withdraw method)for the forth transaction and resets the number to zero how to resets the transactioncount zero in child class checkaccount #include <iostream.h> #include <conio.h> #include <string> class bankaccounts { protected: double balance; public: bankaccounts() {balance=0.0;} bankaccounts(double b) {balance=b;} …

Member Avatar for deceptikon
0
119
Member Avatar for MachDelta

Hi everyone. I've been struggling with a quicksort implementation here. I think - scratch that - I know i'm overrunning an array (erm, vector) based on how it explodes, but I honestly can't see it and I have no debugger. I slept on it but fresh eyes didn't get me …

Member Avatar for ken_taiken
0
229
Member Avatar for new_developer

Hi everyone, I writing a program in which two methods I want to count when it is called. I don't know how to do this. //parent class void BankAccount::deposit(double dep) { if(dep > 0) balance += dep; } void BankAccount::withdraw(double wd) { if(wd > 0 && wd <= balance) balance …

Member Avatar for L7Sqr
0
96
Member Avatar for Umairuddinahmed

How to write a calculator program in c language using command line arguments??? The calculator only needs to perform basic functions of addition, subtraction, multiplication and division of 2 integers only.

Member Avatar for Lucaci Andrew
0
205
Member Avatar for new_developer

I want to write a simple program to check class and inheritance in Code Blocks but i don't know how to write. I have make new project and add new class named "Car". This is main class. #include <iostream> #include "Car.h" using namespace std; int main() { Car c; return …

Member Avatar for new_developer
0
386
Member Avatar for glenwill101

hello ive been working with c++ for a few weeks now and from yesterday ive attempting to write a console game but i keep getting an error. //where all the noise is coming from class Story{ public: Story(); ~Story(); void mainMenu(); void start(); private: void levelOne(); void judgement(); }; Story::Story(){ …

Member Avatar for glenwill101
0
105
Member Avatar for serdar.ilarslan

Hey guys i am in trouble about BST Tree exercise.. i need to create an array that can take number of elements user want and the user has to enter integers but the program need to get this number in one line ... Here is code that i already wrote …

Member Avatar for serdar.ilarslan
0
324
Member Avatar for Youler

Hi everyone, First post here so feel free to school me if my etiquette needs it. I'm reading a very long string of data (genome stuff AT TT GT AA AG AA ... etc) and comparing it using hamming distance with a similar string. (Naively checking for similarity entry by …

Member Avatar for Lucaci Andrew
0
159
Member Avatar for d.noora

**how we can use recursion in implementing tower of HANIO?? and how does it work i need someone's help ??!!!**

Member Avatar for Lucaci Andrew
0
94
Member Avatar for panatda.tokhume

#include<iostream> #include<fstream> #include<sstream> #include<stdlib.h> #include<math.h> #include<iomanip> using namespace std; int main() { int NUM_Object,NUM_Medoid; cout<<"How many menus u have?"<<endl; cin>>NUM_Object; cout<<"How many Medoids(k) do you want?"<<endl; cin>>NUM_Medoid; ifstream myfile("Nutrient.txt", ios::in); int i,j,k,count; count = 0; float TEMP_num; double Object[NUM_Object][5]; double Medoid[NUM_Medoid][5],Medoid_New[NUM_Medoid][5],SUM_Distance[NUM_Medoid],SUM_Pij[NUM_Medoid], SUM_P[NUM_Medoid],SUM_Distance_New[NUM_Medoid],SUM_Pij_New[NUM_Medoid],SUM_P_New[NUM_Medoid]; long double Distance[NUM_Object][Object]; for(i=0;i<NUM_Object;i++) { for(j=0;j<NUM_Object;j++) { Distance[i][j] …

Member Avatar for panatda.tokhume
0
189
Member Avatar for marius2010

Need to find larger prime number then has been inputed.how to do that: I *cin* 5 the reult it self should be 7...?

Member Avatar for Lucaci Andrew
0
192
Member Avatar for letterG

I'm stuck at comparing the operators, it seems I can only compare the current operator to the topmost of the stack, how do I keep on comparing it til the stack is null or the precedence don't hold true anymore?...i've commented the part where I think my program fails...any help? …

Member Avatar for letterG
0
4K
Member Avatar for robotnik

Hi, im trying to make a C++ project for my class which reads the input from a text file and outputs the mean, median, and mode. but im running into an error i get when i run it. i get this error when i try to build it error C2040: …

Member Avatar for Lucaci Andrew
0
396
Member Avatar for bdl365

1. Create arr, an array of size six. Each element of arr is a random two-digit positive integer. (The program should make a random selection using the function rand.) Print the elements of arr. 2. Compute x as the average of the array. Print x. 3. Compute y as the …

Member Avatar for Lucaci Andrew
0
94
Member Avatar for andrew mendonca

Assignment 9, Due Dec 2 Design and implement a program that allows the user to keep track of students in a college course. The program will function as a simple database in which students can be inserted, removed and updated. Additionally, the user can display students in order by name …

Member Avatar for andrew mendonca
0
226
Member Avatar for Weliaz

Hey there people! I have a problem with an application which i'm working on! The problematic code: #ifndef CONFIG_H #define CONFIG_H bool LoadConfig(); XMLElement* Element(std::string name); #endif Where the "XMLElement* Element" is the problem. I am using the library TinyXML-2 for this. If anybody could help I would be very …

Member Avatar for Weliaz
0
335
Member Avatar for ralph1992

I have attached a quick class model of what I am trying to achieve (Also, sorry for the mass of code but I figured I'd post everything I have thus far in case anyone saw other improvements I could make). I can give a customer an 'Account' but I want …

Member Avatar for phorce
0
8K
Member Avatar for QuantNeeds

I am not sure why this is occuring. I declared these functions in the header file and it is defined them in the .cpp file but in the main function it does not recognize them. Did I forget something basic or do something illegal? The errors: : error C3861: 'createAndInitializeTextFile': …

Member Avatar for fiqa92
0
4K
Member Avatar for highonbikes

so the assignment I have is for a bank login program. and the function looks like so Client* Bank::login() based off a boolean value this bank command(which has a private: client* to an array of clients) I have to return a pointer to the correct client or NULL. so simplified …

Member Avatar for Moschops
0
133
Member Avatar for adityasingh95

can sum1 pls explain why there isn't any output??? #include <iostream.h> #include <conio.h> void main() { clrscr(); int a[50][50],r,c,ans=0; cout<<"Enter Size of Array:"; cin>>r; r=c; for (int i=0;i<r;i++) { for (int j=0;j<c;j++) { cin>>a[i][j]; } } getch(); clrscr(); for (i=0;i<r;i++) { for (int j=0;j<r;j++) { cout<<a[i][j]; } cout<<endl; } cout<<endl<<endl; …

Member Avatar for L7Sqr
0
238
Member Avatar for acerious

BEGIN SEQ (n) IF (n <= 3) THEN RETURN n * 2 ELSE RETURN SEQ (n - 3) + SEQ (n - 1) ENDIF END For instance, for n = 8, I ran it in a compiler and the final return value is 38. I tried tracing it in the …

Member Avatar for vijayan121
0
142
Member Avatar for dot_binary

Hello! I'm trying to get the contents of a binary file into a char array, my read function is in main.cpp, in the header file is referenced as char fileio(char * bufferZ) , and is called in another .cpp file. The problem is , the code in the function cant …

Member Avatar for dot_binary
0
260
Member Avatar for savinki

Hi, wt is the function that can use to count number of digits in a long integer? e.g. 12345678 -> 8 11 ->2 456 -> 3 6724 -> 4

Member Avatar for Shahzad Ahmad
0
320
Member Avatar for honey_sw816

Many banks and savings and loan institution compute interest on a daily basis. On a balance by $1000 with an interest rate of 6%, the interest earned in one day is 0.06 multiplied by 1000 and then divided by 365, because it is only for one day of a 365 …

Member Avatar for nullptr
0
83
Member Avatar for 78jimm

I am making a game for a school project with gotoxy and getch and 2d character arrays. there is supposed to be a robot type figure that can move left and right by pressing 'a' and 'd'. so far i've been able to make the cursor go left or right …

Member Avatar for ken_taiken
0
303
Member Avatar for Youler

Consider the following. I have a text file with 5 rows of 5 characters each. I want to read in a line and then compare it to all the other lines. I create 2 ifstream objects pointing to the same file, first and second. first reads in the first line. …

Member Avatar for Youler
0
132
Member Avatar for softwaretime

Could someone please help me find out what the problem is with this simple program? This souldn't be happening. Here is the code: #include "stdafx.h" using namespace std; int main () { int numbers[5]; int * p; p = numbers; *p = 10; p++; *p = 20; p = &numbers[2]; …

Member Avatar for softwaretime
0
269
Member Avatar for DestinyChanger

Hi, I'm working on a robotic project in university and searching for a good robot programming language. If C++ can help PLEASE give me some advise that how can i start robot programming in C++.

Member Avatar for saly305
0
2K
Member Avatar for winter7621

**Please help me out** I am trying to do the following: "Create a program that calculates prime numbers from a certain number X to a number Y. Modify the program so as to run two threads at the same time. The first thread will start counting from X to Y …

Member Avatar for ktsangop
0
2K
Member Avatar for dsprep
Member Avatar for meaad.alhaddad

(A) Write a C++ program to sum all odd integers divisible by 3 in the range (X,Y). Integers X and Y are to be input by the user. Your program should validate that X is smaller than Y, and output error message if not. Note: Use whileloop for the validation …

Member Avatar for Schol-R-LEA
-1
100
Member Avatar for brand.lock

First off thanks for looking at this I have looked all over (both here and on the net) and tried several things trying to get this to work. I am using Visual Studio 2012 with DirectX (June 2010) SDK. I am attempting to write a fuctuin for sprite colission detection. …

0
76
Member Avatar for ktsangop

Hello everyone! I have a rather mysterious problem. I have a mfc dialog based application (running on win xp sp3), and at the same time another mfc app that installs a global keyboard hook capturing the ESC key (this one is always hidden). SOMETIMES when i press ESC key (with …

0
145
Member Avatar for nathaniscool99

Hello, I have been given a class diagram where a variable called light_years must be a const int and stored in the space class, but later on that value must be used in the main file. Below is the space class class space { private: static const int LIGHT_YEARS; public: …

Member Avatar for deceptikon
0
269
Member Avatar for daino

I'm trying to compile a project using Code::Blocks with a MinGW compiler (Windows XP). I have included the correct library file from boost and set the right include path but it doesn't seem to make any difference. Here's the error. The impression I'm getting is PdfContentsGraph class is not initializing …

Member Avatar for daino
0
397
Member Avatar for nuclear

I'm using fstream to read words from a file and I can't just read the whole word like so: ifstream ob("file.txt"); string word; ob >> word; But I need to somehow specify to read 20 positions, even though there might be just spaces included. So I was trying to do …

Member Avatar for vijayan121
0
187
Member Avatar for greatman05

So, I'm trying out a project on my own because I have no real clue how to do anything complex or useful in C++ (applications for example). This project calls for creating a simple console text editor with basic functionality (buffer, command set, redisplay). The problem is that I don't …

Member Avatar for mike_2000_17
0
1K
Member Avatar for vishalonne

Hello I am trying to connect MySQL database from C++ code given below- My development environment is - Window 7 CODE::BLOCKS 10.05 with minGW mingw32-g++.exe MySQL Connector C++ 1.0.5\lib\debug\mysqlcppconn.lib Up to compilation and linking every thing is OK I followed the tutorial [http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-complete-example-1.html](http://dev.mysql.com/doc/refman/5.1/en/connector-cpp-examples-complete-example-1.html) #include <stdlib.h> #include <iostream> #include <winsock2.h> /* …

Member Avatar for Ancient Dragon
0
343
Member Avatar for bops

I am planning on making a program to so that when it is excecuted it carries out the following procedure in 1 go... run command prompt ( system("CMD"); )...then use the command line to carry out the following command... "C:\Program Files\PowerMenu\PowerMenu.exe" -hideself on Im sure i have seen this done …

Member Avatar for Ancient Dragon
0
613
Member Avatar for ollie60

Hi I am currently making a dialog based application in visual c++ 2010 where a chart is going to plot data coming in from an external source. My issue is that I am unsure how to import that data in real time to my application. Does anyone have ideas? Thanks

Member Avatar for Ancient Dragon
0
334

The End.