49,761 Topics
| |
Hi guys, I am new on this forum and I would like you to help me out regarding to the actual errors that I have got. I am using managed c++ as I have switched over from vb.net, however I need your help because I couldn't figure out the solutions … | |
Hi ~ I am getting a strange [B]RunTime Error[/B] while debugging my code. Run-Time Check Failure #2 - Stack around the variable 'player' was corrupted. Code is below. Would love some help on this one. Thanks. ps ~ I realize that system("pause") is frowned upon but it is what we … | |
Implement a class Person with two fields name and age, and a class Car with three fields: (1). the model, (2). a pointer to the owner (aPerson*), (3). a pointer to the driver (also a Person) Write a program that prompts the user to specify people and cars. Store them … | |
I was wondering if I partially specialize a class (which I'm understanding to mean hardcode some of the template parameters?) if I have to implement all functions or if I can just implement some functions. I put together a demo: [url]http://programmingexamples.net/index.php?title=CPP/Templates/PartialClassSpecialization[/url] Where in the main class definition there are two … | |
So I need this to print when vowel you entered instead of just telling you that you wrote a vowel. I'm straight up not sure how your suppose to do that! I went ahead and wrote the code for inputting vowels not sure whats next. [CODE] #include <iostream> using namespace … | |
Hi, I need suggestions on how to count the words, letters, characters on a file . I created a program of it however, when i use the "seekp(0L,ios::beg);", it doesn't go to the beginning. I want to just close and re-open the file but I think there is a better … | |
Well I'm working with structures and need some help with a program. Now if the user chooses to deposit more, I need it to add to the last amount entered... But I'm not sure how to go about doing so. [CODE]#include <iostream> using namespace std; struct the { int num; … | |
I've been scouring the internet and my textbooks and haven't found any good explanations about how to incorporate hexadecimal numbers into my C++ code. I am currently working on a program that acts as a simulated computer environment to run a simulated machine language in the console a maximum of … | |
I have a double value that I need the user to input. How can I make the program catch a letter (char/string) value if they enter it? | |
I am just learning c++ and, I am trying to create a function out of the lines that are surrounded by stars. I am at my wits end! Does anyone have a suggestion or reference that might help me figure this out. Here is my code: [CODE]int a, b, c, … | |
Hello, I have a segmented region in an image, it is not rectilinear. Just a random shape without right angles , much like a circule. I want to calculate the mean on that shape. so I can plot the mean as a starting poiny for drawing a vector. I have … | |
This program is supposed to simply take user input and output it in the right format. It keeps giving me an error message. I cant figure out what is wrong and would appreciate some help. [CODE]#include <iostream> #include <iomanip> using namespace std; int main() { string date[9], dollars[3], cents[3], first_name[20], … | |
Hi, I'm having trouble getting my summation function to work using recursion. I am reading in a set of 10 numbers from a file into an array, then printing the array out using recursion, then I have to take the summation of 1-last number in the array (Ex 1-14). The … | |
Is it possible to overload an operator for a built-in type? And if so what is it's syntax? EG: [CODE]//Use of overloaded operator^ for types double and double (assuming it is overloaded for exponent): double a=10.0; double b=2.5; double pow=a^b;//pow is approximately 316.22....[/CODE] | |
HI. I made a program for my homework it doesnt fulfill the task completely but i think it's gonna do the job.What do you say will it do the job or not ???? Heres the task:Write a program square that calculates the squares of all numbers that are contained in … | |
Hello, This is an extension of this thread: [url]http://www.daniweb.com/software-development/c/threads/357681/1525001#post1525001[/url] My purpose is to create a class that handles a network message. Irrelevant, anyway. CMyMessage: [code=C] #include "stdafx.h" #pragma once #include <conio.h> #include <stdio.h> #include <iostream> #pragma once using namespace std; typedef unsigned char byte; class CMyMessage { protected: byte type; … | |
What do you think is the best, I've heard that wxwidgets isn't really the best one? Give ideas please, thanks in advance! | |
Hi, I am new to C++ and trying to use map in C++. I have a sample program as shown below- #include <iostream> #include <map> using namespace std; int main() { map<char*, char*> m; int i; char name[64]; char val[64]; // put pairs into map for(i=0; i<26; i++) { sprintf(name, … | |
Hello, im trying to make a program that reads from a file and sums up only the numbers.the numbers ar aranged like this in the file: 100er34 67 yyy 7 5 63 6 1 My problem is that the program sums up wrong,it sums some numbers twice when it see … | |
I am just learning c++ and, I am trying to create a function out of the lines that are surrounded by stars. I am at my wits end! Does anyone have a suggestion or reference that might help me figure this out. Here is my code: [CODE]int a, b, c, … | |
Hi, I'm trying to find the resultant of a given data using fstream. I made the program and everything and I believe its all correct however, when I try to run it, I'm getting a linker error saying "undefined reference to Resultant(const double...)" which I can't figure out how to … | |
I just started looking at iterators in my C++ class and don't think I fully understand enough about them to actually create one. I need to add an iterator to this doubly linked list program: [CODE]#ifndef CSLIST_H #define CSLIST_H #include <iostream> #include <cstdlib> using namespace std; template <class T> struct … | |
Edit : Broken from this thread. [url]http://www.daniweb.com/software-development/cpp/threads/35587/175186#post175186[/url] Hello. I got the same problem. But i need to read the string table from a file. I must use a 3d table? The table in the file must look like this: [CODE] A B C D E A QX FN LB YE … | |
Code snippet for removing duplicates in a text file using vectors in c++ | |
If a is greater than b then if a is greater than 300 multiply a by 7. Otherwise— in case a is not greater than b—multiply a by 10. Use only two if and one else. Make sure your else is paired with the correct if. You may have to … | |
Hello all. After going through a deep search on these forums and google as a whole, I have not been able to find a correct piece of advice or input on how I should aproach Guassian Elimination in C++. Ive been assigned to make a program that can perform Guassian … | |
So basically, as of now I have a word and numbers that i am trying to space out for output (the code is in a text file) it's like "HEY10001101" when it's supposed to look like "HEY 10001101". i have the "HEY" stored as an "string command" and the number … | |
I'm trying to make a small text-game that revolves around armies. I have a unit class [CODE] class Unit { protected: string m_name; short m_health; unsigned short m_damage, m_block, m_experience; public: Unit() { } }; [/CODE] This was a rough outline - I'd later add methods that I'd want the … | |
i have a header file which contains a random number generator here is the code: [CODE]#include <cstdlib> #include <time.h> #ifndef RANDOM_H struct rand_var{ int x,y; }Rand_var; static int rand_gen() { srand ((unsigned)time(NULL)); extern int random; random = rand() % (Rand_var.x-Rand_var.y+1) + Rand_var.x; } #endif /* random.h */[/CODE] you will probably … | |
Hello there people, I hope you can help me with this one. I'm having a very serious problem when using the Top() method of a stack, difined like this: [CODE]template<class T> T Stack<T>::Top() const {// Return top element. if (IsEmpty()) throw OutOfBounds(); // Top fails else return stack[top]; }[/CODE] and … |
The End.