you're right, eofbit is set and calling ss.clear works. Could you how seekp got eof?
Type: Posts; User: nimitzhunter
you're right, eofbit is set and calling ss.clear works. Could you how seekp got eof?
I have this function to double a string. It puts a string into a stringstream and uses seekp to replace the old value with new value.
std::string double_str(const std::string & input,...
I have a piece of code that is converting Roman Numerals to int.
int RomanToInt(const string & Roms){
if (Roms.size() == 0)
return 0;
unordered_map<string,int> Rom_Map =...
Could you explain why that needs another parentheses pair?
I have this piece of code from the book "Modern C++ Design" that checks for compile-time error. When i tried to compile it, i get the error "invalid application of sizeof to function type".
Could...
I came upon this sample code which the author said that std::is_pointer<T>::value always evaluate to false. The author didn't explain why this doesn't work and I haven't been able to find an...
Thanks for clarifying. I misunderstood the purpose of mutable. I thought that using mutable would allow me to modify the variable outside of the lambda scope without having to pass the references.
I would like some clarification on lambda.
In the code below, I thought that using "mutable" will let me modify the captured variables. But the lambda function f2() doesn't seem to work that...
You need multimap to have multiple mappings for Carr.
I think mutimap::find needs the spelling of the key to be exact, so that won't help you.
Instead, you can iterate through each element of...
So it's really not safe to use when the lengths are mismatched?
I read the possible implementation of is_permutation from <algorithm> and got a bit confused about the handling of the second range.
template <class InputIterator1, class InputIterator2>
...
I couldn't figure out head or tail with that mess. I just rewrote the whole thing with an array. at least it worked.
thank you everyone for your input.
#include <iostream>
using...
Hi,
i'm trying to calculate 100! for a project Euler problem. However, i ran into an issue while testing. The program does a correct calculation of 14! when i check the answer against google...
take " ofstream a_file("test.txt",ios::app);" outside the loop. you only need to open a file once. Remember to close it with a_file.closed();
question[200]
you're trying to access the 201st...
for(int j = 0; j<5;++j) //fill up the Winning Digits
WinningDigits;
"i" was not declared in the for loop scope, switch it to "j".
cout<<"DISPLAY RESULT:"<<end;
there is no "end" in the...
if (userChoice == 1)
{
BankAccount::makeDeposit(savings);
}
if (userChoice == 2)
{
BankAccount::makeWithdraw(savings);
}
can you change these...
C++ code - 199 lines - codepad
if (userChoice == 1)
{
BankAccount::makeDeposit(savings);
}
if (userChoice == 2)
{
BankAccount::makeWithdraw(savings);
}
int main()
{
return 0;
}
two main functions and you compile without a problem?
void BankAccount::computeInterest()
{
interest = interestRate(balance);<---- interstRate is not a function, it's a variable.
balance += interest;
}
First, n was never initialized. so array[n - *] is undefined.
Second, "if (Move = array[n])", you're assigning, not comparing.
you will need something like this:
for ( int i =0 ; i <...
you're replacing a[2] with a[3], where a[2] = a[3] = 4, so it seems like the 4 is not going anywhere. Then the code replace a[3] with a[4] which replicate the "5" in a[4] and give the "55" in the...
sign up for an account on github.com ( or not) and clone the linux kernel. Proceed to have tons of fun.
Edit: save you the trouble: https://github.com/torvalds/linux
trying to compile yours program. where is "prototypes.h"?
your print_house function also messes up the array.
printf("| \\ Pod %c _ | |\n", Room_x[7]);
Room_x[7] doesn't exist; it's whatever value exists...