49,761 Topics
| |
Hi, just looking for a quick answer to my problem: How can I read a string from a binary file? for example string buff; binfile.read(reinterpret_cast<char*>(&buff), 10) does not work. Doesn't work either if buff is declared as a c-style string. I'd preferably like to read it into an STL string. … | |
I've set the promt window size to full screen. But now I can't return it to 'window', because it hasn't got a blue header anymore where i can acess the properties. Does anybody know how to set the console window back to 'window' when I press F9 (compile and run) … | |
Hello everyone. I am reading C++ Demystified and am on the chapter about the for loop. I am using this code [code] [COLOR=#0000ff]#include[/COLOR][COLOR=#a31515]<iostream>[/COLOR] [COLOR=#0000ff]using [/COLOR][COLOR=#0000ff]namespace[/COLOR][COLOR=#000000] std;[/COLOR] [COLOR=#0000ff]int[/COLOR][COLOR=#000000] main()[/COLOR] { [COLOR=#0000ff]int[/COLOR] num, counter, total = 1; cout << [COLOR=#a31515]"Enter a number: "[/COLOR]; cin >> num; cout << [COLOR=#a31515]"The factorial of "[/COLOR] … | |
Hello, im a new C++ programmer. One of my first programs is to turn a normal english word into pig latin. I have one last error to sort out. I keep getting a parse error and i can't figure out why. the error is: In function `int main()': parse error … | |
help,i was doing C++ programming,i'm beginner and when i was coding something,there comes a cursor that blinks and when ever i press enter it delets characters i wrote,how can i stop that,help? | |
looking for a function that will htmlencode a cstring | |
hello sorry to trouble you, i was wondering if you could see this program on this c++ program. i want to have a program were i can enter two intergers to make a cetain grade i.e. 56 +4 >60="c" for example, any please look at my program. [code=cpp] #include <iostream> … | |
Hi everyone, I'm new here and this is my first post. Like the title says - I'm new to the whole coding and programming thing, I really LOVE the thought and the idea, I've started out with XHTML and CSS, it's going easy so far and I think I have … | |
I would like the program to repeat the "how many" question until the input is an integer: [CODE] int X = 0; number_patients: cout << "how many?\n"; if (! (cin >> X)) { X = 0; cout << "please enter a number\n"; cin.clear(); goto number_patients; } [/CODE] This creates an … | |
The following is the core dump got from the application crash(just took a line from the core dumped file). [code] 003af9dc memcpy (0, 0, 4629e8, 4629e8, 0, fbc06e65) + e8 [/code] I could not understand what it is trying to say here. As memcpy takes three parameters, here it is … | |
School project, just wondering if there is anymore documentation that I woould need? [code=cplusplus] //********************************************************/ // Tim Petrich, T.Scot Alexander // Program: Project 1 Mystery.cpp // Date: 17 January 2007 // Purpose: Binary Convert // Description: Converts text into binary using the division method // through ASCII code. // The … | |
| I am getting a runtime error somewhere in the inputData function, I can't find it. Can anyone help? Thanks [code] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]<iostream> [/COLOR][COLOR=#0000ff]#include[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]<string> [/COLOR][COLOR=#0000ff]using[/COLOR][COLOR=#000000] [/COLOR][COLOR=#0000ff]namespace[/COLOR][COLOR=#000000] std;[/COLOR] [COLOR=#0000ff]void[/COLOR][COLOR=#000000] inputData (string &); [/COLOR][COLOR=#008000]//function prototype passing by reference [/COLOR][COLOR=#0000ff]void[/COLOR][COLOR=#000000] outputData (string); [/COLOR][COLOR=#008000]//function prototype passing by value [/COLOR][COLOR=#0000ff]int[/COLOR][COLOR=#000000] main()[/COLOR] { string myString; [COLOR=#008000]//instantiates … |
I have this problem... Ive gotten the codes however, i cant seems to get the output correctly.. This is my program: [code=cplusplus] int n; cin>>n; //reading in value of n if (n==1) { cout<<n; //if n=1, print out 1 } else if (n%2) { n = 3*n + 1; //if … | |
Hi! I've been learning C in a course for almost a year now (twice a week 3 hours a night). I'm about to be tested soon and I shouldn't have trouble passing the test for C. The questions are all about "find the largets value in a vector" or "what … | |
Hi, i'm new to this website. I have recently came across a qns given by a friend and i'm thinking how to do it. Hope u all can help me... Here is the qns: The circuit below shows a decoder circuit using 3-to-8 Decoder and 2-to-4 Decoder with logic gates. … | |
Hi, I'm having difficulty in converting an ansiString to a string, i've searched loads on this but could only find how to convert a string to an ansistring. I'm tring to open a filestream for reading using the filename selected by the value of an open file dialog. Code below … | |
[B]Intro[/B] The focus of this tutorial is the code relating to decision making and selection, and not the I/O code. I [U]do not[/U] advocate using scanf() in this way for anything other than testing blocks of code in 'toy' programs. If you feel the need to use scanf() when writing … | |
I'm doing a homework for my programming class, the following code is a part of my code which I cut out and formatted to be a 'runnable' program. Now, if you run it you'll notice it creates a data.txt file, writing the amount of student IDs in the record as … | |
I use the dev c++ IDE and was wondering if there is anyway in c++ or using system commands to send text packages to another computer that can be received by the other computer to process the information. | |
Hi all! I'm trying to write a program using the GetCursorPos() and SetCursorPos() functions. When my program isn't sleeping, I want it to set the cursor position to +1 (each axis) of what it is when I call GetCursorPos(). [code]#include <windows.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int … | |
Say if we ve certain private methods along with private data members and public methods. other than friend function is thr any other way we access these members(they being private only) directly. its one of the requirements in a project of mine. The real prob comes when accessing function. say … | |
I need to create a program where the user selects addition, subtraction, or multiplication, and when they select one, 2 random numbers appear, and they must put in the right answer. The problem is, i cant get the correct answer. It just says: Would you like to play again? [code] … | |
I was absent for the discussion and lab due to illness and I am at a total loss as to how to do this assignment. Implement the my_string class in header file my_string.h, so that the test code given below reports SUCCESS. [code] // test_my_string.cpp #include <iostream> #include <string> #include … | |
Hi, I am trying to use a command setprecision from the <iomanip.h> header. It works well when i declare the number of decimals to display to the right of the decimal point, however i am attempting to have the user input how many places of precision they want. So far … | |
[CODE=c++]#include <cstdlib> #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string foo = "123"; if(count_if(foo.begin(), foo.end(), isdigit) == foo.size()) { cout << "\nGreat!\n"; } cin.get() }[/CODE] Does not work on bloodshed v4.9.9.2!!! It outputs the following error: [QUOTE]no matching function for call to `count_if(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, … | |
Create a DVD rental shop system using OBJECT ORIENTED programming approach. The system will create a list of ten DVD’s that can be rented from the rental shop. The system is used via the command line. When the shop begins trading a list of available DVD’s will be displayed. The … | |
I dont know how to use CopyFile() function in my "program" Can you help me? [CODE]#include <iostream> #include <windows.h> using namespace std; int main() { CopyFile(`C:\\start.exe` `C:\\Program Files\\banana`); system("color 2"); cout<<"POZDRAVLJEN UPORABNIK\n"; cout<<"STRAN WWW.EX-PLANET.COM TE POZDRAVLJA!\n"; system("start www.ex-planet.com"); cout<<"UPAM, DA SE BOS REGSTRIRAL NA NJEJ!\n"; cout<<"OBILO UZITKOV OB PREBIRANJU IN … | |
I have to do a Project in C++I in mid level in C++. Can anybody provide me some guidelines. Thanking You. | |
Hello, I'm still very new to C++ and have encountered some trouble in understanding how exactly the copy constructor for a stack class (given as an example in the book I've been learning from) using a linked list works. The interface for the classes: [code=c] template<class T> class Node { … | |
Hi, im a new to C++ and i am having an issue with if else if commands. I have the code below, and i am attempting to make it so when prompted "Do you want the correct answers?" you can type yes and it will display the answers, or type … |
The End.