|
#include <cstdlib> // #include <iostream> // cout feature #include <string> // use of strings #include <sstream> // #include <iomanip> // setw command using namespace std; int education = 0; int heart = 0; int stash = 16;...
Started by Stephen W. Nuchia on
, 40 posts
by 2 people.
Answer Snippets (Read the full thread at microsoft):
Up, Krazy? " << "Do you have a laptop?" << endl ;}
};
main
{
Character *cp = nullptr, Krazy? " << "Do you have a laptop?" << endl ;}
};
main
{
Character *cp = nullptr;< book1.get_count() << endl....
|
|
Hi all, I am kind of newbie on C++, and working on a simple program on Linux which is supposed to invoke another program in the same directory and get the output of the invoked program without showing output of the invoked program on console. This is ...
Started by Ahmet Keskin on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Lt; endl; } else { cout << "in child" << endl; exit(0); }
I have omitted error handling be interested in using the popen() function instead:
FILE *in = popen("./Satzoo", "r"); // use "in" like.
|
|
The title is self explanatory. For some reason in the loop in int main(), if the user wants to input another book, the loop skips the input of the first function and goes straight to asking for the author's name. For example:
Title: The Lord of the Rings...
Started by trikker on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Title: "; std::cin.ignore(INT_MAX); getline(cin,title); cout << endl; return title; else if(question == 'N') { cout << endl; cin.flush(); } else error("Invalid value."); } cout << endl; keep_window_open(); }
....
|
Ask your Facebook Friends
|
I was wondering if enumeration is commonly used with user input. I'm doing an exercise in which in my Book class I have to create an enum Genre with different genre enumerators such as fiction, non, fiction etc.
When the user uses the program, he/she ...
Started by trikker on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You could make some switch -based mechanism, but at that point you may as well just set up your own way of doing it all that works with your... .
C-style enums are not terribly useful for this purpose, since there's no way to recover the original string name .
|
|
I am working with a small group on a C++ project in NetBeans.
For some reason, NetBeans is reporting things like "string", "endl", "cout" as "Unable to Resolve" even though the correct libraries have been included.
The project compiles and runs as expected...
Started by Dan McG on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Or,
using std::string; using std::endl; using std they are underlined again :(
For anyone interested, a few days later I had 6 updates available.
Try std::string , std::endl , std::cout , etc.
|
|
I am familiar with C++ RTTI, and find the concept interesting.
Still there exist a lot of more ways to abuse it than to use it correctly (the RTTI-switch dread comes to mind). As a developer, I found (and used) only two viable uses for it (more exactly...
Started by paercebal on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
Somebody a year.
;() function, and the pure virtual EngineModel interface that he's interested in using.
|
|
What's the most elegant way to split a string in C++? The string can be assumed to be composed of words separated by whitespace.
(Note that I'm not interested in C string functions or that kind of character manipulation/access. Also, please give precedence...
Started by Ashwin on
, 13 posts
by 13 people.
Answer Snippets (Read the full thread at stackoverflow):
In case anyone is interested, the minimalist version which relies upon getline, is the fastest on my.
Tokens) { cout << t << "." << endl; } }
I use this to split string by a delim.
|
|
Recently I've time off of school for a few days and wanted to do a small program(s) experiment in c++ dealing with memory address.
I wanted to see is that if a currently running program (Let call it Program A) that created a pointer to an int object in...
Started by CplusplusRookie on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Win32 offers functions....
It is possible to do this, in a platform-specific way .
Without doing a lot more work, process B can't read or write the memory from process A .
The short answer is that different processes use completely different address spaces .
|
|
Just read on an internal university thread:
#include <iostream> using namespace std; union zt { bool b; int i; }; int main() { zt w; bool a,b; a=1; b=2; cerr<<(bool)2<<static_cast<bool>(2)<<endl; //11 cerr<<a<<...
Started by SztupY on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
Hmm strange, I am getting different output from codepad:
11
111
1
T
The code also seems right to me, maybe it's a compiler bug?
See here
Normally, when assigning an arbitrary value to a bool the compiler will convert it for you:
int x = 5; bool z = x... .
|
|
Consider a class Calendar that stores a bunch of Date objects. The calendar is designed to hold a collection of any type of objects that inherit from Date. I thought the best way to do it is to have a class template such as
template<typename D> ...
Started by Nubsis on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
So you're not actually so much interested about whether D inherits from Date , but whether D.
And not implementation.
|