954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

program problem

ok. so i decided to make a very irritating program that fills the computer its run on with junk. here is what i have done yet:

#include <iostream>
#include <fstream>
int main () {
	int i;
	ofstream filut1 ("allisdust1.txt");
	ofstream filut2 ("allisdust2.txt");
	ofstream filut3 ("allisdust3.txt");
	ofstream filut4 ("allisdust4.txt");
	ofstream filut5 ("allisdust11.txt");
	ofstream filut6 ("allisdust5.txt");
	ofstream filut7 ("allisdust6.txt");
	ofstream filut8 ("allisdust7.txt");
	ofstream filut9 ("allisdust8.txt");
	ofstream filut10 ("allisdus9.txt");
	ofstream filut11("allisdust10.txt");
	start:;
	int blessing;
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut1<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut2<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut3<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut4<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut5<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut6<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut7<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut8<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut9<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut10<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i=100;1>0;i--) {
		filut11<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	for (i = 100;i>0;i--) {
		cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
		cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
		cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
		cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
		cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
		cout<< "HAIL TZEENTCH AND HIS SERVANT, SIR AVALANCHE!"<< endl;
	}
	for (i =100; i>0; i--) {
	cout<< "BLESS THE CHANGER OF WAYS AND HIS SERVANT, SIR AVALANCHE: PRESS ONE!"<< endl;
	cin>> blessing;
	if (blessing !== 1) {
		cout<< "INFIDEL! TIME TO START ALL OVER AGAIN!"<< endl;
		goto start;
	}
}
}

so, i get THESE build errors:
spammer2.cpp: In function `int main()':
spammer2.cpp:5: error: `ofstream' undeclared (first use this function)
spammer2.cpp:5: error: (Each undeclared identifier is reported only once for each function it appears in.)
spammer2.cpp:5: error: expected `;' before "filut1"
spammer2.cpp:6: error: expected `;' before "filut2"
spammer2.cpp:7: error: expected `;' before "filut3"
spammer2.cpp:8: error: expected `;' before "filut4"
spammer2.cpp:9: error: expected `;' before "filut5"
spammer2.cpp:10: error: expected `;' before "filut6"
spammer2.cpp:11: error: expected `;' before "filut7"
spammer2.cpp:12: error: expected `;' before "filut8"
spammer2.cpp:13: error: expected `;' before "filut9"
spammer2.cpp:14: error: expected `;' before "filut10"
spammer2.cpp:15: error: expected `;' before "filut11"
spammer2.cpp:18: error: `cout' undeclared (first use this function)
spammer2.cpp:18: error: `endl' undeclared (first use this function)
spammer2.cpp:20: error: `filut1' undeclared (first use this function)
spammer2.cpp:24: error: `filut2' undeclared (first use this function)
spammer2.cpp:28: error: `filut3' undeclared (first use this function)
spammer2.cpp:32: error: `filut4' undeclared (first use this function)
spammer2.cpp:36: error: `filut5' undeclared (first use this function)
spammer2.cpp:40: error: `filut6' undeclared (first use this function)
spammer2.cpp:44: error: `filut7' undeclared (first use this function)
spammer2.cpp:48: error: `filut8' undeclared (first use this function)
spammer2.cpp:52: error: `filut9' undeclared (first use this function)
spammer2.cpp:56: error: `filut10' undeclared (first use this function)
spammer2.cpp:60: error: `filut11' undeclared (first use this function)
spammer2.cpp:73: error: `cin' undeclared (first use this function)
spammer2.cpp:74: error: expected primary-expression before '=' token
spammer2.cpp:79:2: warning: no newline at end of file
Process terminated with status 1 (0 minutes, 0 seconds)
28 errors, 1 warnings
_______________________________________

what is wrong? and, please tell me what command to use to run another program.
and don't just say "why do you want to do this?"
thanks. out.

sir avalanche
Newbie Poster
7 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

I COULD help you, because the errors are all related to the same problem, but without asking "why do you want to do this?" I can't be sure that you're not trying to make somesort of 'virus'.
So I won't help, sorry :)

Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

ok. this isnt a virus, just that a friend said that i couldn't make a program, so i9'm going to show him i can program. and this isnt very harmful, only creates ten files wich honour me. why i said that you shouldnt ask why was that i need the answer, not another question

sir avalanche
Newbie Poster
7 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

So far your friend is right then!

Ooh that's so cruel.

What is 'start:' I'm no c/c++ expert but that doesn't look like valid syntax to me.

Also you need to prefix cout with std:: or put a using namespace std; at the top between your include directives and the main function. Main should really be int main(int argc, char *argv[])

You seem to have one too many closing braces on the last line.

hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 
So far your friend is right then! What is 'start:' I'm no c/c++ expert but that doesn't look like valid syntax to me.


Actually: it is (sort of). It's a label where you point a 'goto' to. It's a horrible way to loop and should be avoided at all times. So the fact that you didn't know it means that you had a good teacher for C++ :)Also you need to prefix cout with std:: or put a using namespace std; at the top between your include directives and the main function. Main should really be int main(int argc, char *argv[])

You seem to have one too many closing braces on the last line.
Agreed on the namespace part (fstream requires it too).
Main can also be declared as int main() , it's also standard.
The brackets look ok to me, but due to avalanche's sloppy indention, I can't be sure
[edit] On second look, you might be right [/edit]

Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

So far your friend is right then!

Ooh that's so cruel.

What is 'start:' I'm no c/c++ expert but that doesn't look like valid syntax to me.

Also you need to prefix cout with std:: or put a using namespace std; at the top between your include directives and the main function. Main should really be int main(int argc, char *argv[])

You seem to have one too many closing braces on the last line.


start is a etiquette for the goto command. and when i do a second check on this program i can too see most of those faults.

sir avalanche
Newbie Poster
7 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 
Actually: it is (sort of). It's a label where you point a 'goto' to. It's a horrible way to loop and should be avoided at all times. So the fact that you didn't know it means that you had a good teacher for C++ :) Niek


i know its a bad way to loop it, but here it WAS in a if statement, which makes it more forgivable?

sir avalanche
Newbie Poster
7 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 
So the fact that you didn't know it means that you had a good teacher for C++

He he, I didn't have a C++ teacher! I do know what labels are but I don't think I've used one for years let alone used one in C++ which is why I was stumped. I should have STFW ;)

hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You