49,761 Topics

Member Avatar for
Member Avatar for e30rapidic

I have created 3 separate files but having issues with rationalnumber.cpp saying 'Rational' is not a class or namespace name. Any suggestions? Below is what should happen.....but I'm stuck thanks the RationalNumber class should overload the stream insertion (<<) and stream extraction (>>) operators. The stream extraction operator should prevent …

Member Avatar for VernonDozier
0
2K
Member Avatar for empror9

see this code with the queastion [CODE]#include <iostream> using namespace std; int main() { char str[30]; cout << "enter a word: " << endl; cin >> str; // if the user input: malaysia // so the output will be 3 because there are three charchter of 'a' return 0; } …

Member Avatar for batchprogram
0
119
Member Avatar for bbrradd

Ok i need to read in 2 files. The first file contains employee data, and second file contains employee ID# and the hours the employee worked. I need to matchup the ID numbers and add the hours, which i have done. my problem is if there is a invalid ID#, …

Member Avatar for bbrradd
0
107
Member Avatar for HoboConductor

Hello new to the forum, I've been learning and working with C++ for a few months now and I've started to learn how to use strings. What I'm trying to do is take each individual line from a text file and dissect all blocks of text separate by a space …

Member Avatar for caut_baia
0
2K
Member Avatar for Expora

Hello there! Expora here again. I'm trying to get the hang of functions now and I made a simple program to calculate percent but I don't seem able to get it to work I can enter the 2 numbers but when i get the results is something like 0041123f. Any …

Member Avatar for batchprogram
0
137
Member Avatar for pearle

I'm supposed to rewrite a binary search function so that it uses a generic type for array elements instead of just int. The only changes I made to the function are inserting the line "template<typename T>" and changing the line "int binarySearch(const int list[], int key, int arraySize)" to "int …

Member Avatar for pearle
0
571
Member Avatar for twentylemon

So I've been making a program for quite some time, and I've always just worked around this issue because the project wasn't too large, but I've recently been assigned a much larger project, and want to have more files and such. Anyways. Here's the rundown. main.cpp [CODE]... msg(hWnd); ...[/CODE] msg.cpp …

Member Avatar for caut_baia
0
112
Member Avatar for ahmed.123

i want to read in several `4*4` squares of numbers from a file and determines whether or not each of those squares is an increasing square. file containing numbers 3 1 2 3 4 2 3 4 5 6 7 8 9 5 6 7 8 1 2 3 4 …

Member Avatar for ahmed.123
0
122
Member Avatar for 1manik

Hi, I have one program with DLL. Function OpenPort(portNumber) is in this DLL. It is used for open RS232 ports. The program is writted in VC++ Professional edition with using of MFC header. And in this program, there is this important parts for my question: [CODE] CReadSRNDlg::CReadSRNDlg(CWnd* pParent /*=NULL*/) : …

0
57
Member Avatar for 1manik

Hi, can you help me? I have this program and when I compile it, it write me this: 1>main.obj : error LNK2019: unresolved external symbol "void __cdecl OnMessage(unsigned int,long)" (?OnMessage@@YAXIJ@Z) referenced in function "int __stdcall DialogProc(struct HWND__ *,unsigned int,unsigned int,long)" (?DialogProc@@YGHPAUHWND__@@IIJ@Z) 1> fatal error LNK1120: 1 unresolved externals [CODE] . …

Member Avatar for 1manik
0
179
Member Avatar for replax

Hey guys, after compiling my program I get the following error [code]Windows has triggered a breakpoint in *.exe. This may be due to a corruption of the heap, which indicates a bug in *.exe or any of the DLLs it has loaded. This may also be due to the user …

0
112
Member Avatar for nerdinator

Hi. I am trying to create this password storing desktop application. So,I'll need to save all the usernames and passwords the user wants to store in a file and encrypt it,so no one can read from it. I can write an encryption class,but I'm afraid it will become very basic …

Member Avatar for thelamb
0
93
Member Avatar for merse

Is it possible to do function overloading with different return type? For example: [CODE] void myfunc(double x, double y); double myfunc(bool x); [/CODE]

Member Avatar for mrnutty
0
77
Member Avatar for eggberto

I have an integer 'a'. It is a random number from 1-10. How do I express interger 'b' to be a random number from 1-10, but not equal to 'a'? Would it be something like this?: srand ( time(NULL) ); a = rand() % 10 + 1; b = rand() …

Member Avatar for mrnutty
0
94
Member Avatar for timbomo

i cant figure out why this error is coming up saying that "exams" are undeclared identifier. all of them? // basic file operations [CODE]#include <iostream> #include <fstream> using namespace std; void read_file_in_array(int exam[100][3]); double calculate_total(int exam1[], int exam2[], int exam3[]); // function that calcualates grades to see how many 90,80,70,60 …

Member Avatar for Sodabread
0
107
Member Avatar for darrenbkl

[CODE]#include <iostream> #include "IntStack.h" int main() { int i; TIntStack a(5); TIntStack b(20); TIntStack *ip = new TIntStack; for (i=1; i <=5; i++) { a.Push(i); b.Push(-i); } for (; i <=10; i++) b.Push(-i); TIntStack::PrintStack(a); a = b; TIntStack::PrintStack(*ip); delete ip; return 0; } [/CODE] [CODE]#ifndef INTSTACK_H #define INTSTACK_H const unsigned …

Member Avatar for Narue
0
2K
Member Avatar for daviddoria

Consider these functions: [code] void OperateOnDoublePointer(double* a) { std::cout << a[0] << std::endl; } void OperateOnFloatPointer(float* a) { std::cout << a[0] << std::endl; } [/code] This works as expected: [code] double* c = new double[1]; c[0] = 3.3; OperateOnDoublePointer(c); [/code] but when I try to do this: [code] double* c …

Member Avatar for Narue
0
2K
Member Avatar for coding101

Write a function that takes a C string as an input parameter and reverses the string. The function should use two pointers, front and rear. the front pointer should initially reference the first charachters in the string, and the rear pointer should reference the last charachter. rever the string by …

Member Avatar for Narue
0
78
Member Avatar for spdbump08

Hi, I'm hoping someone can help me figure this out. I have to write a program to average scores and print grades using structs and arrays. It's a problem for my class and I think I'm close to finishing but I'm just missing something...maybe a couple of things. I'm getting …

Member Avatar for Sodabread
0
108
Member Avatar for blackmagic01021

I have an attachment PDF with pixel alignment. Then I have this code which assigns short integer to appropriate pixels. [CODE] void CMFC3xxDevice::prepare_data_decompress(data_package_ex &pdata) { char *input = (char*) pdata.pData; int incount=pdata.cbData; int finalarray_pos = 0; DWORD dwTempBufferSize = pdata.cbData; for(int i = 0; i < incount; i+=3) { MFC3XXPixelAlignment …

Member Avatar for Salem
0
179
Member Avatar for obeem

Hi guys, I am trying to make the Tic Tac Toe Class game but I am encountering an error with the initialization of my array for the game board. Instead of initializing everything to blank spaces, random characters end up in there and I don't know what is causing this …

Member Avatar for obeem
0
117
Member Avatar for Uni616

Hey, I have to read numbers from a text file. Heres an example input: 6 8 1 2 10 1 3 9 2 3 7 2 4 2 3 5 5 4 5 3 4 6 8 5 6 4 The parser I coded works fine in NetBeans and Dev …

Member Avatar for VernonDozier
0
111
Member Avatar for sana zafar

Hey, Im trying to write a program that using gauss-jordan elimination to solve a set of linear equations.It reads in two files names for matrix A and C. I have to first form an augmentes matrix (A|C) and then do the elimination.Can any one help me by telling how to …

Member Avatar for mrnutty
0
116
Member Avatar for tarheelfan_08

Hey guys, I have created the following code and I can not figure out how to do one thing, add users. I can do it manually, but I need to prompt the user for two new accounts and then add them to the list. Can someone please inform me of …

Member Avatar for Banfa
0
118
Member Avatar for fugnut

Hello all, I am at the beginning of a new program working with structs and I am getting an error I cannot figure out. My code so far is [CODE]//PJ901 PAtrick Nealey //Acme Payroll Program #include <iostream> #include <fstream> #include <iomanip> #include <cstring> // for _strcmp using namespace std; const …

Member Avatar for Fbody
0
128
Member Avatar for babil

Hi, is there a way to send an integer array with WriteFile to RS232? Seems like I have a data type conversion problem. I would like to do something like this: [CODE]unsigned int buf[3]={1,16,3}; DWORD written= 0; if(isOpen()) { WriteFile(m_hPort, buf, sizeof(buf), &written, NULL); }[/CODE] Thanks in advance!

Member Avatar for Ancient Dragon
0
40
Member Avatar for miturian

So, in the course of trying to write my own matrix-class (as an exercise, if nothing else), I ran across the following problem, exemplified in a dummy class: [CODE]class dummy { public: int a; int b; dummy(int a, int b): a(a), b(b) {}; dummy& operator=(dummy &rhs) { a=rhs.a; b=rhs.b; return …

Member Avatar for miturian
0
110
Member Avatar for Duki

Hey guys, i have this project that, when i compile, 11 of the header files cannot be opened. I have no clue why - i've never seen this type of error. The project is much to large to copy/paste here, but does anyone have an idea of what would cause …

Member Avatar for Fbody
0
556
Member Avatar for yushuan718

Hello all, I am writing a function to download a HTML page from another server. I am wiring this code using MFC's Casyncsocket Basically, this class runs the callback function (onReceive) whenever it detected some new that can be received. Originally, I had something like this: [CODE] void CLASSNAME::OnReceive(int nErrorCode) …

Member Avatar for yushuan718
0
96
Member Avatar for C++_Beginner

Help me please. I don't know where the error is. If you find it i will appreciate it. Very much. It says its inhere somewhere : [CODE] else (ENEMIES > ADVENTURERS) { cout << "\nAlong the way a band of Ogres ambushed the party. "; cout << "All fought bravely …

Member Avatar for C++_Beginner
0
94

The End.