49,757 Topics

Member Avatar for
Member Avatar for lewashby

In the following program how or the two while statements working, `while(szTarget[targetIndex])` & `while(szTarget[targetIndex])` since the their first element is initialized to zero? Zero is false and one is true so how are they getting even one iteration? The book I'M reading also made a point of saying this: "It …

Member Avatar for vmanes
0
74
Member Avatar for trantran

I have been programming in Windows with C++ and I am tiptoeing linux (mainly because of its most up-to-date C++ and also because of it's open source). I want to do multi-platform programming. The programming part is easy: I don't need help there. The part I need help is in …

Member Avatar for trantran
1
299
Member Avatar for dreday92

So for my assignment I have to create the Vector class and apply it .hpp to include the "Vector.h" file and no include the original Vector class. I have a few of the member functions done but am not sure how to begin with the other ones and im wondering …

Member Avatar for dreday92
0
516
Member Avatar for lewashby

How can I grow the size of a char array? `char myArray[6];` Assumming that all the current elements are occupied how can I add more empty element to the array to input another value into?

Member Avatar for 9tontruck
0
153
Member Avatar for FearlessHornet

I'm currently making a DLL with a collection of code snippets that I find myself commonly using. I have made a search functin that checks if one string is inside of another string. I have also added a vector choice in the case that I want to search many strings. …

Member Avatar for mrnutty
0
226
Member Avatar for Hey90

I have created a basic object oriented database of a list of shoes containing the shoe name, number and shoe size. I am trying to sort the list of shoes alphabetially by name and by shoe size. I have the following code: Shoes.h: #include <iostream> #include <fstream> #include <string> #ifndef …

Member Avatar for Hey90
0
4K
Member Avatar for bramprakash1989

i tried the following coding .it compiled without errors but gave absurd results during runtime. can u pls help me with it? [code=cplusplus] #include<iostream.h> #include<stdlib.h> int main() { int i; cout<<"ten random numbers for the range 0 to 50"<<endl; for(i=0;i<10;i++) { cout<<rand()<<endl; return 0; } }[/code]

Member Avatar for dramatic
0
1K
Member Avatar for can-mohan

Hi, Below code snippet belongs to copy constructor implementation. my question is in both cases (without and with copy constructor) if i execute this programme ,it will print the diff-2 memory addresses for both objects. 0x22ff20integer=0 (for object s1) 0x22ff10integer=0 (for object s2) but i believe in case of without …

Member Avatar for deceptikon
0
188
Member Avatar for can-mohan

While executing below code, i found it is not functional due to segmentation fault error,even though memry allocation has been done propery in below code but still not sure why this error is coming. i will appreciat e if somebody help me as just month before i started learning c++. …

Member Avatar for remunance
0
436
Member Avatar for lewashby

I'M reading "C++ FOR DUMMIES" 4th edition by Stephen Randy Davis and the chapter on arrays as just introduced this line -> `cout.width(3);` with absolutly no explanation to waht width is. I would like any of you guys to help me wout here but in addition to telling what .width …

Member Avatar for lewashby
0
236
Member Avatar for stephgoesshazoo

So, I'm suppose to make a program following these guidelines. 1. Count all words in the file. A word is any sequence of characters delimited by whitespace, whether or not it is an actual English word 2. Cout all syllables in each word. To make this simple, use the following …

Member Avatar for deceptikon
0
422
Member Avatar for dmd12b

my complier is throwing an error up when i run it. the problem is run into is my Increment function is etither given a number to increment by, or if it is left blanlk (Increment()) should default to incrementing 1. i thought i could do just 2 functions, one with …

Member Avatar for Moschops
0
950
Member Avatar for kshahnazari

I have a simple question about this code struct a { char key; a *next; }; a = here*; and in the function I check if here is NULL or not if (here->key==NULL) ... and Im sure here is pointing to an a(struct) but it gives access violation . what …

Member Avatar for deceptikon
0
138
Member Avatar for phfilly

Hi all! I just have a quick question about the execution of a copy constructor. This is the code i'm testing my work with as I'm busy learning for a test. Class file: Clock :: Clock (int h, int m, int s) { hr = h; min = m; sec …

Member Avatar for can-mohan
0
293
Member Avatar for can-mohan

Hi, while executing below programme on my Dev-c++ 4.9.9.2 compiler , i was bit amazed as it should have not run properly due to use of deleted object (obj). can anybody let me know instead of crashing , it is getting executed without any memory issue. ~Mohan #include<iostream.h> #include<conio.h> //virtual …

Member Avatar for can-mohan
0
132
Member Avatar for raul8

Hi, I've not worked in C, C++ from like 5-6 years. But now I got to do a very small change (explained below). I tried reading tutorials but only got confused. Below I've struct containing 2 attributes. I need to create its refrence and pass values to these 2 attributtes. …

Member Avatar for rajenpandit
0
238
Member Avatar for swiss21

IM BEGGING YOU TO PLEASE HELP ME,IM NOT REALLY FAMILIAR IN PROGRAMMING BUT I NEED TO DO THIS BECAUSE IT'S OUR DEFENSE NEXT WEEK AND I NEED TO CREATE A PROGRAM IN DEVC++ THAT WILL GET THE EMPLOYEE SALARY AND DATA,I KNOW SOME OFYOU GUYS CAN HELP ME CREATE A …

Member Avatar for NathanOliver
-3
206
Member Avatar for silvercats

I can't find the error. Logical error. Total and tax comes as 0. After logging in,enter a desired item number. press 0. then total comes as 0. #include <iostream> #include <conio.h> #include <string> #include <cstdlib> using namespace std; void mainfunc (); void Exit(); struct menuItemType {int itemno;double price;string menuItem;}; void …

Member Avatar for silvercats
0
170
Member Avatar for johnnydiamond08

Hello, I keep getting errors saying "Invalid conversion from pointer to integer and I have tried both of the following operators * after the variable as well as & and nothing seems to work. All input is greatly appreciated. Thank you all for your time. void Stack::print( ) { StackPtr …

Member Avatar for Moschops
0
325
Member Avatar for Teefy

I want to perform Gaussian Elimination on a matrix which is read in as a text file. The format of the text file is as follows: 3 1 3 2 5 0 2 4 4 3 0 9 1 where the first line is the dimension n of the matrix, …

Member Avatar for phorce
0
406
Member Avatar for greatman05

First off, this is a homework assignment. I am in a Software Engineering class and we're learning how to work with MFC. We're editing a basic calculator app. I don't know how to implement the backspace button (delete a single character from the edit box when the Backspace button is …

Member Avatar for Ancient Dragon
0
317
Member Avatar for Ancient Dragon

I know how to create a function with variable argument list, but how do you create one when the argument type is unknown, something like MyPrintf(...) ? From what I've read CLR/C++ only supports known argument types, such as int, `MyPrintf("...array<Int32>^ arr)` and the calling function int main() { MyPrintf("One", …

Member Avatar for triumphost
1
680
Member Avatar for kenney.d.lewis

this code compiles, but when i run the program, it outputs "floating point exception". to my knowledge this happens when you divide by 0, but ive worked it out on paper, and i am not dividing by 0. its the method implementation for a class. if you need it i …

Member Avatar for Moschops
0
255
Member Avatar for akasya

Hello Community, i have a text file... with example following content: Pizza 23232 Car 44,495 Drink 3493,90494 .... .. . and so on.. no i want to find the 44,495 in this textfile.. calculate a new value like 44,495 x 2 + 5 and write the same file as Pizza …

Member Avatar for Bumpehh
0
81
Member Avatar for phorce

Hello, I have a question. I'm not sure I am using the right terms or anything here, but, I have seen people develop their "projects" (classes etc..) and then creating a .dll file (or .lib) and then importing the files when they need them. But I cannot seem to get …

Member Avatar for phorce
0
305
Member Avatar for VernonDozier

I am looking for a portable method of checking whether overflow has occurred when multiplying unsigned integers. The way I have always done it in the past is to turn my unsigned integers into uint64_t's, multiply, then create a uint64_t with a value of 2 to the 32nd power and …

Member Avatar for deceptikon
0
172
Member Avatar for rfrapp

I'm writing maze traversal for a school assignment, and I've got an issue. The X will move through most of the maze, but then it will get stuck at a position and keep cycling through. This is probably because I'm not checking properly to see if it hasn't been to …

Member Avatar for rfrapp
0
910
Member Avatar for eric.i.perez

1.Make and run a program that will output all the prime numbers from 1-100. (FN do prime) 2.make and run a program that will allow the user to input 10 numbers and display the total number of positive and negative numbers entered. 3. write a program that reads numbers until …

Member Avatar for NathanOliver
0
140
Member Avatar for nUmbdA

#include <iostream> using namespace std; int main() { //declare variables const double FEE = 10.00; double total_fee, charges, checks; //display header information cout << "Chapter 4 Homework\n\n"; //request input from user cout << "Enter number of checks written this month "; cin >> checks; cout << "\n"; if (checks = …

Member Avatar for nUmbdA
0
150
Member Avatar for A Haunted Army

i'm having a bit of a problem getting my collision handler to work correctly, my collision detection works fine but handling the movement after the collision is where things have gone a bit buggy. the idea is that if the object is colliding horizontally it will be moved back before …

0
78

The End.