hello, i have found some other with this problem but it diddent solfe it for me.
Thats why i ask it here,
I am trying to learn the langue c++ i write in Visual studio 2005 and 2008 pro
this is my first little program byside hello world and calculater.
I get 2 warningings and one error

are the errors
1>c:\documents and settings\ampieper\mijn documenten\c\calculatortest\calculatortest\calcu.cpp(10) : error C2447: '{' : missing function header (old-style formal list?)
1>c:\documents and settings\ampieper\mijn documenten\c\calculatortest\calculatortest\calcu.cpp(43) : warning C4129: ' ' : unrecognized character escape sequence
1>c:\documents and settings\ampieper\mijn documenten\c\calculatortest\calculatortest\calcu.cpp(64) : warning C4129: ' ' : unrecognized character escape sequence

/* try 1 to make a calculator in console and to store the information */


#include <iostream> // includes iostream
#include <fstream>	// ellows the program to write and reed files
#include <string>
using namespace std;

int main ();
{
	string item;	//	what item
	item = input1);
	string what;	//	what do you want to do ?
	what = input2;	
	string listi;   //	list of items in storage
	listi = input3;
	string listu;	//	list of users
	listu = input4;
	string ae;
	ae = input10;

	ifstream edit (item".txt");
	ofstream reed (item".txt");	

	long input1;
	long input2;
	long input3;
	long input4;
	long input10;
	int a;	



	cout << "do you want to withdraw or deposite?" << endl;	// TODO add output!!
	cout << "W = withdraw / d = deposite / i = itemlist / u = userlist" << endl;
	cin >> input2 ;	// what do you want to do?
	cout <<"what do you want to withdraw"<< endl;	// asking what item your looking for
	cin >> input1 ; // what item are you looking for?

	if (what=w())
	{ 
		
		while (! " with\ "reed".aof"());	// notsure if its good here ( opening a folder and file )
		{
			getitem (reed,item)
			cout <<"you have" item << endl;
			reed.close();
		}
		cout << "how many do you want?" << endl;
		cin >> input10;
		item - input10 = a ;
		a < 0 cout << "ERROR" << endl;			     // look if its posible
		a = 0 cout << "WARNING! LAST ONE!" << endl;     // Give warning if it was the last one
		if (edit.is_open())
		{
			edit << item"\n";
			edit << a"\n";
			edit.close();
		}
		else cout << "ERROR!" << endl;
	}
	if else (what=d()) // probleem bij het openen als het betsand nog niet bestaat
	{
		while (! "depo\ "reed".aof"());	// notsure if its good here ( opening a folder and file )
		{
			getitem (reed,item)
			cout <<"you have" item << endl;
			reed.close();
		}
		cout << "how many do you want to deposite?" << endl;
		cin >> input10;
		item + input10 = a ;
		a < 0 cout << "ERROR" << endl;			     // look if its posible
		a = 0 cout << "WARNING! LAST ONE!" << endl;     // Give warning if it was the last one
		if (edit.is_open())
		{
			edit << item"\n";
			edit << a"\n";
			edit.close();
		}
		else cout << "ERROR!" << endl;
	}
	else cout << "ERROR!" << endl;
return 0;
}

bevore the warnings ware errors too, then i put some " "next to the other txt and removed .txt from the strings

then they turned into warning
what it actualy is i dont know i do remeber wen i tried to do such same ting with html and php it diddent work also with string, that is solfed too just c++ now

the last error at row 10 "{"
I have tried removing from row 9 the ; and adding a > infront or >> as i reed in other posts
that gave me some more errors (sintax error) mainly

if its posible explain me also how you/ or howto solfe this problem please.
i'm info thirsty :icon_exclaim:

alredy many thanks to those who want to help!

>int main ();
Remove the semicolon.

>while (! " with\ "reed".aof"());
I can't imagine what you're trying to do here, but it's probably this:

while ( !reed.eof() )

You don't want to close the file in the loop that reads it. Also, using eof() as a loop condition is a bad idea. It would be better for getitem to return a success or failure flag and use that as the loop condition.

while (! "with\ "reed".aof"());

with\ is a folder,
notsure if its posible too

Thanks alot :) for the reply i go try it out now!

>with\ is a folder, notsure if its posible too
It's not possible the way you're doing it.

Hmm

>int main ();

I tryed with semicolon and with out
with it gives me 2 errors
The warnings stay the same.
but will find someting for it :P
its more about the errors

hmm is there maybe a include file missing for the > or maybe its becouse i am using visual studio ?

1>c:\users\alex\desktop\program\calculatortest\calculatortest\calcu.cpp(9) : error C2059: syntax error : '>'
1>c:\users\alex\desktop\program\calculatortest\calculatortest\calcu.cpp(10) : error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\alex\desktop\program\calculatortest\calculatortest\calcu.cpp(43) : warning C4129: ' ' : unrecognized character escape sequence
1>c:\users\alex\desktop\program\calculatortest\calculatortest\calcu.cpp(64) : warning C4129: ' ' : unrecognized character escape sequence

and with out 3 then it says that ( ; ) is missing

Do yourself a favor, never write a whole program and then try to debug it. You'll just drive yourself crazy. Start like this:

#include <iostream> // includes iostream
#include <fstream>	// ellows the program to write and reed files
#include <string>
using namespace std;

int main ();
{
      return 0;
}

when that compiles and runs as expected then go to this:

#include <iostream> // includes iostream
#include <fstream>	// ellows the program to write and reed files
#include <string>
using namespace std;

int main ()
{
   string item;  //what item
   item = input1);

   return 0;
}

When you get that to compile and run , then add another line or two and keep repeating.

That doesn't mean you shouldn't write out the flow of the program or even some psuedocode for the whole program at once--you should. But with the actual code, go in ministeps, at least until you have a fair amount of experience.

Thank you,
I will try to write evryting in steps agen
and see if i can find what went wrong

if i find it i will post it here.

Thank you Narue, and lerner.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.