49,761 Topics
| |
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 … | |
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; } … | |
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#, … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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*/) : … | |
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] . … | |
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 … | |
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 … | |
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] | |
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() … | |
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 … | |
[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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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! | |
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 … | |
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 … | |
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) … | |
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 … |
The End.