49,761 Topics

Member Avatar for
Member Avatar for PIXXAR

IM HAVING PROBLEM WITH THIS PROGRAM, GOING BACK TO THE MAIN PAGE AND SELECTED PAGE, IF THE USER ANSWER NO, THE PROGRAM WILL GO BACK TO MAIN MENU IF THE USER ANSWER YES, THE PROGRAM WILL COMPUTE THE SAME PROBLEM. help PLS... THE PROGRAM BELOW WONT GO BACK TO COMPUTE …

Member Avatar for PIXXAR
0
997
Member Avatar for shankhs

can anybody suggest me whats wrong with the code?? [code] #include<iostream> #include<string> using namespace std; void rev_str(string str,int n) { while(str[n]!='\0') rev_str(str,++n); cout<<str[n-1]; } int main() { string str="shankhs"; rev_str(str,0); return 0; } [/code] thanks

Member Avatar for venugopal.somu
0
503
Member Avatar for sfurlow72

Alright, this isn't actually homework. I'm going back to school so I figured I would brush up on some programming before I go. I'll be taking the second course in a three course C++ programming sequence (starts with classes, recursion, etc.), so nothing too advanced yet. I wrote this program …

Member Avatar for ravenous
0
312
Member Avatar for while(!success)

Hey guys, I need help recognizing multiple digit numbers that are read so that I may push said number into a stack for future evaluation For example: 22 3 + should evaluate to 25 When I input 22 3 +, my output is evaluated to 5 Any help/criticism is welcome …

Member Avatar for WaltP
0
2K
Member Avatar for FraidaL

I'm writing some while loops but I feel like there is a better way to write them. [CODE]int i=3; while (i<31) { cout << i << " "; i+=3; } //this one is for the first 10 terms of a sequence starting with 3 and adding 3 each time. int …

Member Avatar for zeroliken
0
209
Member Avatar for sfurlow72

What's the difference between having a const function and declaring const after the function? For example, if I had a class Myclass with some private data members and I set up a public function called int getMyValue(), what would the difference be between declaring that function as: [CODE]const int getMyValue();[/CODE] …

Member Avatar for L7Sqr
0
178
Member Avatar for nivek10

class class1 { //variable declaration }; class class2 { public: int func(void *msg); // others func... }; int class2::func(void *msg) { class1 *pointer = (class1 *)msg; //others declaration. } I would like to ask reagrding on this line of code : class1 *pointer = (class1 *)msg; the class declaring a …

Member Avatar for nivek10
0
351
Member Avatar for triumphost

When do I really need to use Delete in Destructors? if I do Point P = new Point(); I've been told every time I use new, it stays in memory even when out of scope and that I should use delete to remove it.. so do i need to do …

Member Avatar for triumphost
0
758
Member Avatar for james6754

I have put my code in to separate classes instead of having it just inside one class. Here is my constructor, I have also included my file which defines the class (#include "Matrix.h") [CODE] Matrix::Matrix(int* m,int* n)//constructor takes two ints { M = (*m); N = (*n); this->ptr = new …

Member Avatar for thines01
0
103
Member Avatar for ThomsonGB

I am trying to parse main(argc, argv[]); and i need to look at individual characters with in the strings pointed to by *argv[]. I though of a string as an array of chars. This builds fine but causes an error in execution. So what is a simple and straight forward …

Member Avatar for ThomsonGB
0
1K
Member Avatar for kuramahiei

[CODE] void command() { int CourseDistance, StartTime, FinishTime; char cmdChar = ' '; do { cout << "Command? : "; cin.get(cmdChar); switch (cmdChar) { case 'd': case 'D': cout << "Enter New Course Distance (NM): "; cin >> CourseDistance; break; case 's': case 'S': cout << "Enter New Race Start …

Member Avatar for kuramahiei
0
167
Member Avatar for triumphost

I did not know WHERE to ask this as there is no "General" section on the site this site that I know of. Lets say I found code online but it's under the GPL 3 License.. I read it but it doesn't say that I cannot translate it from Pascal …

Member Avatar for mike_2000_17
0
102
Member Avatar for gabriellogan

I want to modify this Radix sort C++ to work with strings only. I want to sort words not numbers. I don't know what to change or where to change it. Any suggestions? [CODE] // CS 9F // March 3, 2012 // Include files #include <iostream> // used for cin, …

0
105
Member Avatar for Chuckleluck

Hello, Suppose I have a chess game. I make a nice class to handle an entire player's pieces: [CODE]class c_ChessTeam { private: // all pieces derive from class c_ChessPiece c_Rook Rook[2]; c_King King; c_Queen Queen; c_Bishop Bishop[2]; c_Knight Knight[2]; c_Pawn Pawn[8]; public: . . . };[/CODE] But what if I'm …

Member Avatar for mrnutty
0
181
Member Avatar for Zvjezdan23

Hi everyone! =) Since my teacher can't help me out or doesn't respond when his hours say he's in his online office, I need some help. I am coding Tetris; and I have to say I'm doing a decent job so far. I just need help with constant movement. =/ …

0
85
Member Avatar for prasenjit_das

Hi ALL, Which c++ compiler is best creating graphics related project.please suggest me. thanks in advance

Member Avatar for DeanMSands3
0
2K
Member Avatar for Rubinder singh

I am using windows 7 ultimate 32-bit edition, But when I try to run any dos screen like command prompt, c++ compiler etc. They are not going to full screen mode, Please tell me how to run my c++ compiler or any dos screen in full screen mode ……in windows …

Member Avatar for CityThrille
0
508
Member Avatar for minxminx

This is a code which sorts arrays. I use clock_t to determine the processing time for my code. However, it always stacks with the time taken from before. It looks like it's just adding the results. [code] int main(int argc, char *argv[]) {unsigned long n;//size of array -- long for …

Member Avatar for Labdabeta
0
594
Member Avatar for jtbens01

Hi all, I'm having trouble will inheritance in c++. I am using a BaseNode class and deriving other node classes that can except different types of data. The problem I am running into is I can't find a way to make a decent copy function that can make an exact …

Member Avatar for mrnutty
0
130
Member Avatar for jonnyboy12

Hello all. I am working with managed c++ ,cli. I am working on a large project and cannot afford to make any mistakes. In cli from what i have seen usually when i construct classes i use this ^ character to do so, like this [CODE] //header file public ref …

Member Avatar for Ancient Dragon
0
217
Member Avatar for Susmita_Sikder

hallo everybody, i am doing program in dev c++ 4.9.9.2,but problem is that when i run a program under one project which contains more than one programs then it gives a warning.." project is not compiled".where i am wrong..please give me solution. thank you in advance

Member Avatar for Ancient Dragon
0
170
Member Avatar for utkarshsahu

I wanted to write a program to check if string entered is a palidrome. I wrote a program but i get errors while compiling. Can anyone help me identify errors in the program. [CODE] #include<iostream> #include<string> int main(){ string input;bool flag=false; cout<<"Enter String: "; cin>>input; cout<<"You Entered "<<input; int length= …

Member Avatar for utkarshsahu
0
183
Member Avatar for Bennys

I have a program for class where I have to read a file of with names and numbers into a class of objects and dynamically allocate it. Header file [code]#include <string> #include<cstring> using namespace std; class Movie { private: string movies; float rating; double profit; public: Movie() { movies = …

0
41
Member Avatar for ayershuja

using circular link list by using class Class Employee { Eid integer ; Ename string; Esalary real ; Edesignation string ; } how we can do following operation: Create a link list Insert a node after a specific node with a given Eid Insert a node before a specific node …

Member Avatar for jigglymig
0
115
Member Avatar for jigglymig

I am trying to make the heapSort function I wrote work with the heapRebuild I was given. If someone could please tell me what exactly I am doing wrong or help point me in the right direction. [CODE]void Heap::heapRebuild(int root) { // if the root is not a leaf and …

Member Avatar for jigglymig
0
238
Member Avatar for shopnobhumi

Hi i have just started my c++ class and really having hard time with that.i was assigned to draw a graph which should look like dis : ***** ***** ***** ***** ***** This is what i am trying but getting only this result : ***** * * * * Please …

Member Avatar for kavita_gunaji
0
809
Member Avatar for Quicxic

Hello, I have a problem with a header I'm trying to make. In Main.cpp, I have this function to store the combinations of the elements of vector S: [CODE=c++]template <class T> vector<vector<T> > combinations(vector<T> S, ll k) { vector<vector<ll> > combs = ncombinations(S.size(), k); vector<vector<T> > setcomb(combs.size(), vector<T>()); for(unsigned int …

Member Avatar for Quicxic
0
199
Member Avatar for aakanaa

Hi, i am new to C++. recently i have a project that require to create an array of queue. However, i don't have an idea how to create this. Can i create an array of queue by doing queue<int> q[2]? Any explanation will help, thank you very much

0
43
Member Avatar for rfrapp

Hello, I need to demonstrate the binary search using recursion, and I've run into a little problem. In my example, if "key" was 1, 2, 3, or 6, then it would return true. Anything else would give me an error. Why is that? Here's my code: [CODE] // binary search.cpp …

Member Avatar for rfrapp
0
254
Member Avatar for triumphost

Am I wrong that the answer is 2?? Teacher refuses and says that it's 3 because the compiler spits out 3 for ans.. but if I do it manually with pen an paper or with the cout<<v2%v1++, it spits out 2 which is what I get on paper.. [CODE] #include …

Member Avatar for mike_2000_17
0
315

The End.