49,761 Topics
| |
I am having trouble using cin.getline and classes. Here is the code[CODE] #include <iostream> #include <cstdio> #include <cstdlib> #include <string> #include <fstream> using namespace std; class RememberPlans { public: string date; string subject; string resources; string description; }; RememberPlans nds; // Function Prototypes bool enterPlans(RememberPlans& nds); void exportData(RememberPlans& nds); void … | |
A University has decided to computerize its exam grading. They have a standard paper that contains 25 multiple choice questions each with four choices. All the answers by students are entered in a file. You are to read the file and calculate if the student passed or failed (60% or … | |
Is there any macros in DarkGDK like this: [code=c++]#ifdef __DARKGDK_WINDOWS #include "MY_WINDOWS_HEADER.h" #else #include "MY_LINUX_HEADER.h" #endif[/code] any help would be appreciated, thanks in advance! | |
I'm from a C background and need help with the following lines of code [CODE] struct IGame { // Summary // Entry function used to initialize a new IGame of a GameMod // Parameters // pGameFramework - a pointer to the game framework, from which a pointer of ISystem can … | |
Hi guys, I have written some C++ code to do three things: 1. Read data from a delimited file (user specifies type of delimiter used), and return data as a "2D array". 2. Print 2D array to console. 3. Write the 2D array to a tab delimited text file. I … | |
hi i am currently doing a project, and want to build in MFC...however i have just started working on it and find it really confusing... i have some doubts..please clear it as this is really very urgent(i have to complete the gui in a very short time) 1) I have … | |
Hey Guys, Im having a spot of trouble with dynamic memory allocation and any help would be appreciated. My problem is the I have 2 classes Bank and Account and I am making a dynamic array of the Account member variables. Everything seems to work fine until I try to … | |
[CODE]void getinput(char sentence) { cout << "enter something => " << endl; char ch; cin.get(ch); int count = 0; int i = 0; while(ch >= ' ' || count >= SIZE) { if (isalpha(ch)) { [B] [COLOR="Red"]sentence[i] = ch; [/COLOR][/B] i++; } cin.get(ch); count++; } }[/CODE] This is the function … | |
I have made a base class and a derived class and I am having a couple compile errors. [QUOTE]SavingsAccount.hpp(9) : error C2512: 'Account' : no appropiate default constructor available[/QUOTE] What i want to do is be able to give the savings account an inital balance and it changes the currentBalance … | |
What operator would I use on a variable to increase it for addition from another variable. Thinking loops perhaps. Like the loop add's data to that variable but plus's it on, instead of changes it. So 50 + 60 = 110, instead of 50 + 60 = 60. Also, if … | |
(Using MS Visual Basic 2008) Hi, I have been ask to create a program that allows the user to input the hours worked and the payrate for a number of employees (note: Hours work and the payrate can all be differ, there is no set payrate), the number of employees … | |
Im getting these two errors, here is the whole code besides the edits and i know the edits works so their not important here. Error 6 error LNK2019: unresolved external symbol "int __cdecl loadArray(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const (* const)[2])" (?loadArray@@YAHQAY01$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main Q6_A1_CODE.obj Error 7 fatal … | |
I'm writing a program to gain info and then print it. Problem is when a person enter $1231 for my account the $ crashes it. I would like to use cin.peek to check if it is there if it is delete it so far i have [code] cout << "Balance … | |
This is such a simple issue, it's embarrassing to have to ask.. but I've been having trouble with this theoretical issue of defining string arrays (and even integers!) outside of their class. Here's some code: [CODE]#include <iostream> #include <string> using namespace std; class desu { public: string ok[4]; // Give … | |
Ok I have a problem here. I'm in my game engine class and for some unknown forsaken reason they decided to teach console c++ then jump to c# for windows apps, then back to c++ to do directx apps, so my skills with c++ and windows apps is well krappy. … | |
I'm VERY inexperienced in programming, I'm just learning the very basics. Anyways, I just figured out how to add a "pause" line to keep the program from closing as soon as I run it, but now there's a nasty "Press any key to continue" after my text. Is there a … | |
Hi, First of all, i have a Resources.h file, which has the following statement: [CODE] #include <iostream> #include <string> #define string Greeting "Hi" [/CODE] So i also have Prompt.cpp; [CODE] #include <iostream> #include <string> #include "Resources.h" int main() { cout << Greeting << endl; system("pause"); } [/CODE] But, i have … | |
Hello, Can any of u help me with this assignment.. I tried to do it myself but cuz I'm new in Object Oriented my program was full of errors that I don't know how to fix :( Please help me as soon as possible.. here is the question: Write class … | |
hello people, its the very first time im doing programming stuff.And i have done nothing so far.I found a booklet in my bookcase,it's about C++.,ts just the first booklet of a serie. i use visual c++ 2008 express,i did new>file>C++ i used the same codes as in the booklet,here it … | |
hi everyone, may I request a sample code on how to read/write a binary file in C++. Thanks. | |
I'm running a simlpe hello world program in visual c++ but in the console mode but i keep getting all these errors unbale to start program c:\users\johnathan\warfield\documents\Visualstdio2008\projects\program1helloworl\Debug\program1 helloworld.exe the system cannot find the specified file. how can i find this error??? | |
[code] #include<iostream.h> using namespace std; class first { int reverse() { char name[]={'k','a','v','i','t','h','a','/0'}; int 1=0; while(name[i] != '/0') { i++; cout<<"value of i is"<<i<<endl; } } int main() { first f; f.reverse(); } }; [/code] my file's name is cpp.cpp and i cannot run it using ./a.out I get a … | |
Hi, when i run my program the following error occurs: "Unhandled exception at 0x00415b72 in testMatrix_size.exe: 0xC0000005: Access violation writing location 0xfdfdfdfd." and seems to happen over the line converting a string to double: n = Comma - Position; Numbers=line.substr(Position,n); Data[i][j] = atof(Numbers.c_str()); //problem is here. The program does the … | |
I'm trying to write a program which reads a file really small size with two number and a character and ouput another file which can have up to 120.000.000 characters. is unistd equal to direct system call function? and if yes is it the fastest way to read/write data on … | |
Here is an ex of a problem I'm having difficutly with. I need to make up a program that does the following: asks user for the number of seconds and the number of miles traveled program should convert the given number of seonds into different units of time in years/days/hours/minutes/seconds … | |
I am currently trying to write a program to compute permutations of the array [0,1,2,3,4,5], I need to save all the permutations to another array and I also need the first digit, 0, to be fixed. I have searched through quite a bit of literature on doing this, however I … | |
Hey - I'm new asking questions here. I'm writing a simple program to give a number to a power using a recursive function (inconvenient, but that's the assignment). It seems as though the program should work, and debugging shows that it almost does. It has the right value up until … | |
Hi all, Currently, i'm having a window to show rows of data. the following is for 1st row: [ICODE]a0_1->Text = "blah,blah"; b0_1->Text = "blah,blah"; c0_1->Text = "blah,blah"; d0_1->Text = "blah,blah"; e0_1->Text = "blah,blah"; ...............[/ICODE] And as for the 2nd row, its just a change for the last integer of the … | |
how do i make a macro saying that the platform is windows? like this: [code=c++] #ifdef WINDOWS //this is the one i am talkin about #include "windowsHeader.h" #else #include "linuxHeader.h" #endif [/code] | |
Hey guys, I was wondering... I always assumed that references were more or less constant "dereferenced" pointers. With that in my mind I tried to do this: [code=cpp] #include <iostream> #include <string> using namespace std; void outputIt(const string * const textz00rs){ cout << *textz00rs << endl; } int main(){ outputIt("window"); … |
The End.