49,761 Topics
| |
I've created a class and create two new objects from that class. 3 variables are stored as private. I have mutator and access functions for these variables. When I try to write a value through these functions, they don't seem to change the variable in the class. What am I … | |
What could be the possible explanation of this program output? I am trying to learn c++ so please help [code]#include <iostream> using namespace std; int main( ) {int b[3][2]; cout<<sizeof(b)<<endl; cout<<sizeof(b+0)<<endl; cout<<sizeof(*(b+0))<<endl; // the next line prints 0012FF68 cout<<"The address of b is: "<<b<<endl; cout<<"The address of b+1 is: "<<b+1<<endl; … | |
I have a Windows program (Visual C++ CLI Type) that displays video in a sub window. When something happen the user makes a note of the event by hitting a button. The problem is that the event involves a number of choices and finding the right button to click is … | |
I have a program in which i open a a text file, access it's values and create and array with it. for example the text file may contain these values: 1 44 3 4 33 6 7 8 61 10 ; that's 10 integers what c++ tools could i use … | |
I have a strange bug in vs2008. ostream open fails when called in the following manner: [CODE=c++]ofstream filestr; filestr.open((filename.c_str()),ios::in|ios::out);[/CODE] when called like this it works without a hitch: [CODE=c++]ofstream filestr; filestr.open("blahblah.txt",ios::in|ios::out);[/CODE] Any ideas? Thanks | |
Hi I got a code that in pseudo dos something like [CODE] ifstream os; while(os.oef()){ os.getline(buffer,length); } [/CODE] If some condition is met, I'd like to be able to jump back to the previous line, such that the next getline will give the line just-read in, at a later time … | |
Hi, I have some questions on vector. Please consider the code below. I use g++ compiler on Linux. [CODE=c++] #include<iostream> #include<vector> using namespace std; class Sampler { int a; int b; }; int main() { vector <int> vec1; vector<float> vec2; vector<Sampler> vec3; cout << sizeof(vec1) << " " << sizeof(vec2) … | |
The age old issue of string parsing comes up again ... I have a text file that contains lines that are SUPPOSED to follow a set format, specifically: string, string, long string int string double int The delimiters are therefore: Comma (,) for the first two fields Spaces for all … | |
Not sure this is going to be easy to explain but ... I have a class (A) that needs to have access to a map (mapCodes), this map is the same for all instances of class(A), therefore I don't want to create an instance of the map for each instance … | |
[code] string s; cout<< "Enter name: "; cin >> s; cout<<"\n"<<s; [/code] on running this i need: Enter name: Tejesh Kinariwala Tejesh Kinariwala it is showing: Enter name: Tejesh Kinariwala Tejesh so how to get the input till user hits return key, instead of breaking it at space | |
i've wrote a code that read and write to some files, and i have a segmentation fault when i'm running it in the g++ (in the visual studio i don't have any problem like that..) anyway, i think the fault may come from this line, can anyone tell me if … | |
Hi i have to make this work... [code=cplusplus] //INFO: -eingabeprüfung auf buchstabe/zahl // -eingabeprüfung auf zahlenbereich // -wiederholung einbauen vill... #include <iostream> using namespace std; int main() { int eingabe; cout<<"Geben sie eine zahl ein> "; cin>>eingabe; if(eingabe>0 && eingabe<13) { switch(eingabe) { case 1: cout<<"eins"<<endl; break; case 2: cout<<"zwei"<<endl; … | |
gives me error main /* The purpose of this lab is to open a text file and then make a copy of it */ #include <iostream> #include <fstream> #include "Interface.h" using namespace std; int main() { //open up file to be read from string input; ifstream in; cout<<"enter file name … | |
I'm trying to write a program that asks the user for a number between 1 and 10, then prints a line of that many “X"s. The program compiles, but I cannot figure out how to make the variable 'total' print X's instead of a the actual number, if that makes … | |
I need to write a program that decides if you can apply for the job or not. After asking a series of questions (all the questions) the program then needs to print out whether you can apply or not. Here are the requirments for the job • If you are … | |
I'm having a lot of trouble finding enough RAM for a program I'm writing on Vista 64 Ultimate system, even though the system has 8GB RAM and only 2GB is used. I tried to see how many 10 million byte blocks I could allocate using malloc(), and the compiled program … | |
Help, am a c++ student who is completely stuck. I know that there are some stupid errors in this, I've been working all day on this and I still can't find them. I'm supposed to create a class, copy constructor, and than create an instance in main and then create … | |
I have a slight homework problem that is giving me some trouble. We have to write the algorithm for subtraction using different bases as a possibility in a program that uses calculator registers. The following is the provided prototype: bool subtractRegisters( int registerX[], int registerY[], int registerZ[], int base ); … | |
Hi there! With reference to the annoyance of this problem, I've spent some time searching the web as well as on here however, with few ways to extract useful threads from those less useful when typing 'RegSetValueEx int' or the like, posting was a final solution. Apologies if this type … | |
how can I use a loop to sum random numbers together? it needs to be able to sum any amount of numbers determined by the user. I can generate the random numbers but adding them is a different story. I tried to make an inner loop (if that makes sense) … | |
I often hear the saying that iostream is inefficient in terms of performance, and it is better to use printf family if type-safe is not concern. But as far as I know, the static type checking (is this thing people call the 'type-safe' do?) is done in the compilation, and … | |
Hello, I happen to be a novice in the realm of C++, and I'm currently confused due to this error when trying to run my application: "Assertion Failed. Expression 'stream != NULL' ". I've looked it up, and nothing that comes up can answer why it gives me said error. … | |
Has anyone tried to write [URL="http://support.microsoft.com/kb/307398"]this tutorial [/URL]using VC++ 2008 Express? The article claims to be written with VC++ 2005. But I thought 2005 and 2008 used compatible versions of CLR language. I'm getting all kinds of compiler errors -- for example [icode]String* str;[/icode] instead of using [icode]String^ str;[/icode] and … | |
Please need some help on what servers in windows/linux can c++ applications be deployed? Is the .exe file deployed or a library is created out of the application for deployment? thank you | |
I have to open a file whose name i am constructing by concatenating various inputs from the user. If I write: [code] string s = "filename.csv"; ofstream fout; fout.open(s,ios::app); [/code] it gives error for using s in fout.open(). It says it is a wrong form. I need to use a … | |
The problem that i couldn't know if the mistake from the code or from the compiler? i have been setup cygwin.........as starting to learn Linux and into it as a start to learn c++ i want to compile a (hello world) code ================== [code] #include<iostream.h> void main() { cout<<"helloworld"; } … | |
I'm a newbie to C++ and am wanting to make a game where Zombies come after you and you slay them, along with jumping, running, shooting, stabbing, well you get the point but idk how. also i have a main menu done but i don't know how to preview it … | |
Hello, I am trying to compile a set of files. I got fustrated to the point of taking the actually instructor files from the book and compiled them. I am using AndLinux and the g++ compile to run my programs. If anyone is familiar with the book "Accelerated C++" I … | |
Here is my final product: [code] #include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; void printGrade(int oneScore, float average); void printTable(int scores[], int id[], int count); float computeAverage(int scores[], int count); const int MAX_SIZE = 21; void readStudentData(ifstream &rss, int scores[], int id[], int &count, bool &tooMany) … |
The End.