49,757 Topics
| |
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 … | |
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 … | |
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 … | |
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? | |
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. … | |
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 … | |
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] | |
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 … | |
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++. … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. … | |
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 … | |
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 … | |
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 … | |
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, … | |
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 … | |
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", … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
#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 = … | |
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 … |
The End.