49,761 Topics

Member Avatar for
Member Avatar for Secone

Hello, I'm trying to have my program locate any duplicate strings in an array, say, there were two instances of the word 'man', it would add 1 to the Word Amount of that word, and move the duplicate to the back of the array in some way. The problem is, …

Member Avatar for vijayan121
0
239
Member Avatar for daino

My initial thoughts on the default constructor are that it was called automatically. From what I can see, it seems that this is so but a constructor called automatically doesn't initialize int or char variables for exampe, to Zero as I originally thought. It appears that they initialize the variable …

Member Avatar for vijayan121
0
297
Member Avatar for r0vanz01

I am trying to find the minimum number when the user enters any 5 numbers I am not sure why this code is not working, every time I run this function I always get 0. Can someone please tell me what is wrong! int i; int num1 = 5; int …

Member Avatar for r0vanz01
0
184
Member Avatar for pkfx

Im trying to increase a dynamic array by 1 element and assign a integer variable to it but recieve a heap overload error. Any advice would be appreciated. void CardSet::AddCard(int cardNum) { int* tmp; nCards++; tmp = new int[nCards]; for(int i = 0; i < (nCards - 1); i++) { …

Member Avatar for Ancient Dragon
0
183
Member Avatar for dreday92

///Can someone tell me why I am having an issue calling my functions?!?!?! #include <iostream> #include <iomanip> #include <string> using namespace std; struct Players { string name; int numPlayer; //Number of the Player int numPoints; //Point's scored by Player }; const int SIZE = 50; const int MAXPLAYERS =3; typedef …

Member Avatar for Ancient Dragon
0
171
Member Avatar for Carpetfizz

Hello, I learned a lot of basic C++ programming through Code Blocks and I think it is a fantastic IDE. I decided to switch to VS2010 Professional for various reasons, and because I am able to get it free from Dreamspark. I had created another post a while back similar …

Member Avatar for Suzie999
0
166
Member Avatar for Salman93

program in which we calculate total marks in a course and print a course grade by using if-else conditions. However check, if user enters correct marks or not, for example midterm marks is between 0 to 20. If user enters midterm marks less than 0 or greater than 20 then …

Member Avatar for WaltP
-2
130
Member Avatar for riccardo-m

Hi, I've been trying to send a long integer from an Arduino to my C++ program via the serial port. There seems to be many examples of this when i search, but I've not had much luck except for one example. This example seems to work, but not when I …

Member Avatar for riccardo-m
0
3K
Member Avatar for rtyui

Hi. I am trying to assign the value returned by asctime(struct tm \*) to a string. But when the program is run, I got segmentation fault. GDB shows: Program received signal SIGSEGV, Segmentation fault. 0x0000003e6d6aa192 in __offtime () from /lib64/libc.so.6 What could be the reason? Can't we assign the value …

Member Avatar for deceptikon
0
377
Member Avatar for pattilupwned

Hello, I am having trouble passing a file into parallel arrays. Based on the code below, I get a bunch of jumbled numbers on my cout screen that don't even show up in the input file. I have attached a PNG of the console output. I am at a loss …

Member Avatar for Suzie999
0
436
Member Avatar for maple23

I am trying to learn multi-dimensional arrays in C/C++, but am not having much luck. I think I understand the way this type of array works, but I am having problems. [code]#include <stdio.h> #include <stdlib.h> #define MAX_NAME_COUNT 10 #define MAX_NAME_LEN 100 int main(){ char *names[MAX_NAME_COUNT][MAX_NAME_LEN]; int x; printf("enter the names …

Member Avatar for richard_arnold
0
766
Member Avatar for agachhayat

//This programm is for testing function overloading #include <string> #include <fstream> #include <iostream> using namespace std; class Text { string str; public: Text (); Text (string); string contents (); }; Text::Text (string st) { ifstream in (st); getline (in, str); } string Text::contents () { string ret; ret=str; return ret; …

Member Avatar for np complete
0
81
Member Avatar for melissa.kapolka

void getScores(float **scores, int num) Can someone help me understand what this means? Especially the **scores.... I know what a float is and that it is to get scores inputed in by the user. Thanks

Member Avatar for melissa.kapolka
0
94
Member Avatar for andigirlsc

I am having trouble getting MS Visual C++ to recognize my input for the 2nd getline I have listed. It already recognizes getline(cin, firstName) and allows for input, but won't recognize the second instance of getline. When the program gets to that line of output, it bunches the next two …

Member Avatar for deceptikon
0
384
Member Avatar for ChilledGrease

I started coding C++ this past week, and yesterday I challenged myself to write something original that my book doesn't have hints on. It is a program that prompts the user to think of a number between 1 and 100, and proceeds to guess the user's number. The user tells …

Member Avatar for Suzie999
0
284
Member Avatar for nitishok

I have written a program for the 8-Queens problem.It prints all possible solutions. queens() finds all the possible solutions. ok() tells whether the given column and row is safe or not. The very strange problem is: 'Count' won't increment. I have no idea why. #include<iostream.h> #include<stdlib.h> #include<conio.h> int arr[8][8]={0}; int …

Member Avatar for deceptikon
0
167
Member Avatar for nikhil.pro
Member Avatar for Ancient Dragon
0
104
Member Avatar for riccardo-m

Hi, I'm making a program using Visual Studio 2010. I'm strugging with how to correctly use classes and their instances. For example; What is the difference between using the following ways to call function from one class within another... Example 1: Dialog.h #include OtherClass.h MyOtherClass myClass; Dialog.cpp myClass.MyFunction(); Example 2: …

Member Avatar for riccardo-m
0
253
Member Avatar for Tinnin

Hi all. I'm working my way through "Accelerated C++" have a question regarding chapter 5. The program calculates students final grades by taking a median of the homework grades. I am trying to alter this program so that it uses *list* instead of *vector*. The issue I'm having is with …

Member Avatar for Tinnin
0
171
Member Avatar for dhruv_arora

My school and the education board uses Turbo C++ as the compiler. I have Windows 7 64 bit. Can anyone tell me how can I install Turbo C++ on my computer.

Member Avatar for harsh01ajmera
0
449
Member Avatar for 03Mach1

So I am trying to write a program that will tell you the lowest grade and the highest grade out of the 3 wthat you put in and also tell you the current average you have in the class. I got the lowest and highest part taken care of but …

Member Avatar for np complete
0
262
Member Avatar for linc186

I've been trying to get this to build for hours, I have no idea what's wrong. Any help is appreciated, thank you. Here's the code: main.cpp #include "SDL/SDL.h" #include "Core.h" #include "GameStates.h" #include "globals.h" int main(int argc, char** args) { if(core.Initilization(640, 480, 32, SDL_SWSURFACE) == -1) { SDL_Quit(); } while(core.desiredstate …

Member Avatar for gusano79
0
281
Member Avatar for limzhengtong

**this is my displacement.h** #ifndef DISPLACEMENT_H #define DISPLACEMENT_H class displacement { public: displacement(double, double, double); double getvalue(); private: double s,t,a,v ; } #endif **this is my displacement.cpp** #include "displacement.h" ;using namespace std; displacement::displacement(double t1,double a1,double v1) { t=t1; a=a1; v=v1; s = v * t -(0.5) * a * t …

Member Avatar for zvjezdan.veselinovic
0
406
Member Avatar for slasham

im very new to c++ and was just wondering if its possible to make a simple program where you type the name of the file and when you press enter it downloads that file from the internet to a certain place on your computer. where would the files be stored? …

Member Avatar for np complete
0
849
Member Avatar for muhammads

Hi All, I am new to C++ on linux enviroment and am trying to use the png++ library for a project. The problem i am facing is that that a simple program i write using png++ incudes does not work and shows me the following errors > AProg.o: In function …

Member Avatar for np complete
0
276
Member Avatar for myk45

Hello All! To check for return values from a function and setting error flags, i am currently using the following approach: bool fine = true; fine &= func1(); fine &= func2(); .. and so on. if (!fine) { // error } Could anyone please let me know if there is …

Member Avatar for myk45
0
203
Member Avatar for montjoile

Hi! I want to execute a method without pressing the enter key, what I want to do is get the press key an save it in an array while the user is typing, but I dont know how to execute an event without pressing the enter key here is my …

Member Avatar for montjoile
0
457
Member Avatar for sajis997

Hello forum, I believe that i have the design problem that i need to discuss about. Intersectable is the super-class; Triangle and Sphere are the sub-classes of the Intersectable i believe that you already realized class inheritance structure. I have the following pure virtual functions declared inside the INTERSECTABLE virtual …

Member Avatar for sajis997
0
107
Member Avatar for np complete

There are N horses in the stable. The skill of the horse i is represented by an integer S[i]. The Chef needs to pick 2 horses for the race such that the difference in their skills is minimum. This way, he would be able to host a very interesting race. …

Member Avatar for np complete
1
1K
Member Avatar for shmay

I'm trying to read from a text file. Pretty simple, right? I guess not. It gives me this error message: Debug Assertion Failed! Program: F:\Debug\lab1431.exe File: fscanf.c Expression: stream != NULL For information on how your program can cause assertion failure, see the Visual C++ documentation on asserts. [code] #include …

Member Avatar for randomjokar
0
698

The End.