49,757 Topics

Member Avatar for
Member Avatar for Tinee

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 …

Member Avatar for WaltP
0
76
Member Avatar for NvIs

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; …

Member Avatar for NvIs
0
89
Member Avatar for livinFuture

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 …

Member Avatar for WaltP
0
394
Member Avatar for Buolbear4444

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?

Member Avatar for Fbody
0
63
Member Avatar for MadRedCzech

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, …

Member Avatar for livinFuture
0
211
Member Avatar for jowana

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 …

Member Avatar for drkybelk
0
110
Member Avatar for skips

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], …

Member Avatar for skips
0
681
Member Avatar for mrgreen

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 …

Member Avatar for mrgreen
0
123
Member Avatar for Labdabeta

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]

Member Avatar for L7Sqr
0
175
Member Avatar for finchh

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 …

Member Avatar for Ancient Dragon
0
90
Member Avatar for Buffalo101

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; …

Member Avatar for Buffalo101
0
685
Member Avatar for Silvershaft

What do you think is the best, I've heard that wxwidgets isn't really the best one? Give ideas please, thanks in advance!

Member Avatar for Stefano Mtangoo
0
404
Member Avatar for trips_shubh

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, …

Member Avatar for trips_shubh
0
5K
Member Avatar for zyberb

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 …

Member Avatar for Insensus
0
283
Member Avatar for MadRedCzech

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, …

Member Avatar for WaltP
0
148
Member Avatar for Tinee

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 …

Member Avatar for Tinee
0
104
Member Avatar for rhuffman8

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 …

Member Avatar for rhuffman8
0
276
Member Avatar for fradiavolo

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 …

Member Avatar for Greywolf333
0
158
Member Avatar for Shruti4444
Member Avatar for Lokril

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 …

Member Avatar for Lokril
0
115
Member Avatar for Gus Garza

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 …

Member Avatar for Gus Garza
0
101
Member Avatar for magravis

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 …

Member Avatar for magravis
0
107
Member Avatar for ichigo_cool

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 …

Member Avatar for L7Sqr
0
87
Member Avatar for altXerror

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 …

Member Avatar for altXerror
0
148
Member Avatar for flowerzink

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 …

Member Avatar for flowerzink
0
255
Member Avatar for eman 22
Member Avatar for Talguy

I am spliting my soft real-time application into two processes, one is the gui and the other is the hardware communications. I would like to to have both processes monitor each other as they send data back and forth. When one detects that the other has crashed it will launch …

Member Avatar for L7Sqr
0
77
Member Avatar for osirus0830

I am currently attempting to teach myself C++ so I don't have the benefit of a prof or TA. The question at the end of the chapter that I'm working on wants me to create an array of structures and to initialize the array of structures using the new function. …

Member Avatar for osirus0830
0
183
Member Avatar for ninjatalon

Today I was taught about virtual methods but got lost somewhere in the pointers. Here is an example [CODE] class Person { protected: string name; public: virtual string get_name() { return name; } }; class TFaculty:public Person { private: string title; public: virtual string get_name() { return title + " …

Member Avatar for Fbody
0
140
Member Avatar for magravis

Hi! I am trying to make a program, where it opens a text file. If it reads, for instance the "UP and the 2 #s after" in the file, it will print, on the same line (with the data) a result of another #. for instance: (command, code, and code2 …

Member Avatar for WaltP
0
115

The End.