I feel like you can do erase(vector.begin()+n) a lot of the time.
Edit: was totally thinking of something else ::)
Type: Posts; User: nicoqwertyu
I feel like you can do erase(vector.begin()+n) a lot of the time.
Edit: was totally thinking of something else ::)
Elaboration on above post:
#include <iostream>
// Boring class to test list with
class rect {
public:
rect() { m_width = 0; m_height = 0; }
The outcome for every student will be different (very different); simply make sure you follow the guidelines given in the assignment. The other posters here have done a very nice job of breaking it...
Yes that's how you use a structure.
Here's a generous example.
// <iostream> inscluded for std::cout
#include <iostream>
// Here we declare a structure, named rectangle
You're missing some things.
Also, you're including stdio.h, but using cout; replace <stdio.h> with <iostream>.
The book your instructor assigned knows.
Watch what your code is doing and you can see why it's tweaking out. You should always try and trace what's happening, as each line of code runs, to spot where you've gone wrong.
// This...
If you're on Linux, you should give Valgrind a try.
Why not pass the circle, defined in main, to getCircleData -- similar to how you did calculateCircleData?
MinGW contains the tools Code::Blocks will use to create/debug/link your executables.
Ah, you're quick. Proof-read after post. Whoops.
wxWidgets is nice.
...
// I don't think you need a string reference to store the
// city. I _believe_ that a copy is returned.
void getCity(string line, string& city)
// string getCity(string line) {
{
// If...
Here's a little help, but I have to run to the DMV so I can't look through it much more this morning
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
#include <string>
int main(int argc, char* argv[]) {
std::string mystring = "Hello, World!";
return 0;
}
Is the same as:
What does buildArray do? All you've given is a function declaration.
void printArrays (int family[], int item[], int quantity [], double price[])
{
int i;...
You don't simply want to replace srand with rand: you want to use both.
As MK27 stated, you call srand once to seed the random number generator, then use rand in your
loop to get your random ...
1.) You're trying to access a pointer that points to garbage.
hired[lastused] = new Hired(int);
2.) Don't try to call a constructor explicitally, it's called upon "construction." To call the...
You're still including *.cpp files, and you shouldn't be.
book.h is including itself, and it shouldn't be.
There is an include outside of ISBN.h's include gaurds, and there shouldn't be.
ISBN.h is...
Give this a look-through: it's pretty good
Something like this... I'm sure someone will come in after me to put in their corrections.
In a linked list, each node contains a pointer to the node created after it -- except that last node,...
Am I getting warmer?
enum {
STATE_IDLE,
STATE_CONNECTING,
STATE_CONNECTED,
STATE_DISCONNECTING,
};
#include <iostream>
#include <vector>
std::vector<monster> monsters;
void AddMonster(int hps) {
monster m;
m.m_hps = hps;
monsters.push_back(m);
FunctionNameThatGoesThroughAFileAndOutputsAllLinesStartingWithALetterToASeparateFile(var infilename, var letter, var outfilename) {
var InFile
var Line
var Vector
var OutFile
InFile =...
You can always use fileName.c_str(). It will return a const char*, I believe.