49,761 Topics
| |
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 … | |
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 | |
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 … | |
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 … | |
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 … | |
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] … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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 … | |
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, … | |
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 … | |
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. =/ … | |
Hi ALL, Which c++ compiler is best creating graphics related project.please suggest me. thanks in advance | |
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 … | |
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 … | |
| 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 … |
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 … | |
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 | |
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= … | |
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 = … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 | |
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 … | |
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 … |
The End.