Andreas5 13 Junior Poster in Training Team Colleague

Wow, when I use that code you gave me, I get a whopping 104 errors! New record, baby. Well I guess I should post my real code, since I do quite a bit while iterating.

I apologize, i forgot to mention a few things.

#include <list> // new
#include <iterator> // new
using namespace std; // new
for (list<bullet>::iterator i = bullet_list.begin(); i != bullet_list.end(); ++i) {
	bool isalive = i->alive;
	// do stuff
Andreas5 13 Junior Poster in Training Team Colleague

Try

for (list<bullet>::iterator i = bullet_list.begin(); i != bullet_list.end(); ++i) {
	bool isalive = i->alive;
	// do stuff

Edit: Lists dont got the [] operator because it would be very slow, so you have to work with iterators.

Andreas5 13 Junior Poster in Training Team Colleague

It looks like you did not declare a string.

#include <string>
using namespace std;
string str;
str.length()
Andreas5 13 Junior Poster in Training Team Colleague

The code worked when i tested it. Printed the characters in ..\Projects\test2\test2\A.txt until it hit space.

Andreas5 13 Junior Poster in Training Team Colleague

no:D

Andreas5 13 Junior Poster in Training Team Colleague

I dont know any simple way to do that.

Andreas5 13 Junior Poster in Training Team Colleague

There are many things wrong with the code. Here is a code that does what you want, and looks almost the same:

#include <iostream>
#include <string>
using namespace std;
int main()
{
	string s;
	cin >> s;
	if(s == "oscar")
	;
	else{
		cout << "\n\aIncorrect password.\n" << endl;
		system("pause");
		return 0;
	}

	cout << "Correct Password" << endl;
	cin.clear();
	cin.ignore(255, '\n');
	cin.get();
	return 0;
}
Andreas5 13 Junior Poster in Training Team Colleague

I made another one because it was fun :P

//Prints the Array.

	int alreadyPrinted[ARRAY_SIZE];
	int printed = 0;
	bool already = true;

	for (int i = 0; i < ARRAY_SIZE; i++)
	{
		int n = 0;
		for(int j = 0; j < ARRAY_SIZE; j++){
			if(myList[j] == myList[i])
				n++;
		}

		already = true;
		for(int j = 0; j != printed; ++j)
			if(myList[i] == alreadyPrinted[j])
						already = false;


		if( myList[i] != 0 && already ) {
			cout << myList[i] << " appears " << n;
			if(n == 1) cout << " time." << endl;
				 else cout << " times." << endl;
			alreadyPrinted[printed++] = myList[i];
		}
	}
Andreas5 13 Junior Poster in Training Team Colleague

This is one solution:

for (int i = 0; i < ARRAY_SIZE; i++)
	{
		int n = 0;
		for(int j = 0; j < ARRAY_SIZE; j++){
			if(myList[j] == myList[i])
				n++;
		}
		
		if( myList[i] != 0 )
			cout << myList[i] << " appears"
				 << n << "times." << endl;
	}
Andreas5 13 Junior Poster in Training Team Colleague
Lusiphur commented: Link looks like a VERY useful site! Thanks :) +1
Andreas5 13 Junior Poster in Training Team Colleague

When you call

>>string word2("Over");

the string class detects that you passed an array of characters to it and uses that to create word2.

When you call

>>string word3(3, '!');

the string class detects that you have passed an integer as first parameter and a character as second, it creates a string that looks like this "!!!".

Once you learn about classes and constructors you will understand how the string class decides what to do with the arguments you give it.

Andreas5 13 Junior Poster in Training Team Colleague

It can probably be done using the macro functions within excel. You can do almost anything with them.

You can record you actions on one file and makeit repeat on many files, and at the same time write the result on a report file.

I think so atleast.. Even tho i dont got much experience with it.