49,757 Topics
| |
In the following program everything works fine when I enter 5 or 8, but if I enter 4 or 7 the program crashes with a Segmentation fault error. I'm just trying to add zeros until the number of characters in string is evenly divisible by 3 and I'm doing so … | |
Which is faster way to use an element pointer rather than an index when scanning arrays? need some clarification why? | |
I am creating a simple area calculator that exhibit overloading. I already finished the overloading function, my concern is, I want to key trap the pressed letters/characters by the user. I want to allow only numbers (int & float data type) input. How will I do that? Thanks. I am … | |
Are you able to have multi-character switch statement cases? So if this is my code: #include <iostream> using namespace std; int main(){ char choice; cout << "Enter a word >" << endl; cin >> choice; switch (choice) { case 'ball': cout << "You entered ball" << endl; break; case 'bike': … | |
Hi, I am stuck trying to figure out how to include a class within a class and how to properly call members of a class from the main(). I cannot figure out what these error messages mean. I would greatly appreciate and insight into my dilemma. Thank You, C.D. Enclosed … | |
Hi, I am trying to create a function which takes two chars and a char* string. Then run the function and replace each occurence of Char1 with char 2. E.g. String = Apples. Char 1 = A. Char 2 = B. Char 1 is present in string so replace all … | |
Im trying to add Total function and isMono functions to this code. Did total already Need help with function ismono which returns whether a tree is mono (all the elements are unique aka no element appears more than one time) or not. Please this is the original program #ifndef T_H … | |
I am trying to work out how to pass a pointer from my C# interface application to the C++ back-end functionality DLL. I tried searching Google but can't work out what I'm doing wrong.. I'm used to using * for pointers and just changing the value in the pointer through … | |
I'm looking for a really good 3D and/or Game engine to work with? I currently use C++, though I am willing to switch if the it's worthwhile :) Thanks in advance. | |
Hello! I'm very interested in compiler/language design but It's an extremely complicated topic so I've recently tried to wrap my head around and understand one of the beginning and main parts, lexical analyzation. I'm not here to ask for code or anything but I've tried thinking up various methods of … | |
Sorting algorithms are an important part of managing data. There are many sorting algorithms. Each algorithm has particular strengths and weaknesses. You are asked to write two programs in C++, one for Insertion Sort and another for Merge Sort. Compare the execution time for both programs for different data sets. … | |
Hi everyone, I have created a program with my whole day and night hard work in dev C++ and now im trying the same code in Visual Studio C++ 6.0 ... I'm showing you the code of that program, kindly guide me through this, or correct the problem in getting … | |
Hi! I'm a newbie in C++ and encountered myself with a problem: how to transfer data from a text file (containing data in "yyyy.mm.dd" and "09:00" format) into a two dimensional array ? What I want:to convert 2003.12.20 into 20031220 and 10:15 or 09:00 or 00:00 convert into 1015 900 … | |
I have this function that should open two files and write their content in a third file, separated by "\n". I don't get why it works for code in comments and not for the one below it, although both provide valid text file names. void concatenate() { /*char *file=new char[strlen(" … | |
Hi, I need a function that will take a tree as argument and return the number of ints that were typed and a correct call. would it just be preorder? like below. Please. Thanks #include "t.h" void preorder(tnode * t){ if (t == NULL) return; cout << t->info <<endl; preorder(t->left); … | |
hi every one ! i'm sorry to be so bothering but i really don't know how to solve my problem here: Mathematically, the placement problem of testers into the right nodes) can be modeled by merging the two introduced knapsack variants: multidimensional and multiple knapsack problems. The obtained model is … | |
i installed a codeblocks IDE in my flash drive while i was using windows 7. After downgrading to windows XP, the IDE won't open and an error message pops up "codeblocks.dll is not a windows dll." Pease assist in help me solving this. Thank you. | |
Hi, I was wondering if someone could look at this person class I am working on. The first part is the class header with the constructors for the class. In the second part I am trying to write the code but when I declare the get_age and get_name objects I … | |
I am writing a program that has two windows. One window draws the shapes you choose in window2 and saves them in a list. When clicking on the second window once the first shape is supposed to move to the spot clicked. If double clicking the second shape and so … | |
Hello all: I've been reading up on C++, which seems pretty cool. In my office, the HR representative has to manually calculate an employees vacation & sick time. So I was thinking if it's possible to create a program for her to help her out a bit. This is what … | |
Hello! I've been very interested in the V8 JavaScript engine recently, so I fetched the source and built it successfully, so far so good. I also successfully compiled the [Hello, World!](https://developers.google.com/v8/get_started) program Google provides. I've also read the [embedders](https://developers.google.com/v8/embed) guide. Other than that I can't find any documentation or examples … | |
ive been trying to improve my skills when it comes on to using maps and iterators but i seem to be mostly failing can someone please tell me where im going wrong or point me in the right direction compiler error a.cpp:20:55: error: conversion from ‘std::map<std::basic_string<char>, Object*>::iterator {aka std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, … | |
Hello Programmers! How can I convert a double to a string without losing its precision (i.e. values after the decimal point)? Thanks! | |
I am new to programming and i am now free for 2 months after my exams, i want to learn some basic and very necessary classes or their functions or objects which are used for file folder handling. Kindly suggest some methods which i can learn. | |
Hi all I am trying to remove consecutive blank space by single blank space but getting error by this small line- `ch='';` This is what I have done till now- #include <iostream.h> #include <ctype.h> #include <conio.h> void main() { char ch; int count=0; ifstream in_stream; ofstream out_stream; clrscr(); in_stream.open("A.txt"); out_stream.open("B.txt"); … | |
I have the following structure: CObject { protected: char *mName; public: CObject(char *n) { mName=strdup(n); } }; CVector:public CObject { char *mValues[50]; int mElements; public: CVector(char *n):CObject(n) {} }; CMatrix:public CObject { char *mValues[50][50]; int mLines; int mColumns; public: CMatrix(char *n):CObject(n) {} }; My main function: int main() { pV=new … | |
I have to write a code in which i want to use 3 dimensional array but i am reaaly confused that how 2 dimen array is indexed. 2x2 array can easily be indexed 00 01 10 11. so how a 3 dimen one can be indexed? | |
Hello, I have a chain of inherited classes like this: class A { protected: int a; public: int getA(){return a;} }; class B:public A { protected: int b; public: int getB(){return b;} }; Based on that you can see that the public can only read the values in those classes, … | |
I was trying to array a string within a string. And I keep on receiving a compiler error. So I’m wondering if is even possible to string a string within a string? Because that’s the error I keep on getting. If not then what is another way to create a … | |
I have always had this question, but I couldn't quite find anything that answered it. I was hoping someone could shed some light on the question... Thank you in advance. |
The End.