ARGH! Ap

tweakmm

Lifer
May 28, 2001
18,436
4
0
Ok, I am trying to do a licene plate program using functions and I am getting this one sytax error 'declartation sytax error' i am trying to use functions
please excuse the comments, I am tyring to get this thing to work.
#include<iostream.h>
#include<string.h>

void getInput(char &alpha , int &numeric);
//char processEverything(char &alph, int &num)
//void PrintOutput(final)

int main()
{
int alpha,numeric
//char final

getInput(alpha, numeric);
cout<< &alpha ;
//final = ProcessEverything(&alpha, &numberic)
//PrintOutput(final)
return 0 ;
}

void getInput(alpha, numeric)
{
cout<<"What are the letters of the licence plate?";
cin>>alpha;
cout<<'\n'<<"What are the numbers?";
cin>>numeric;
}
 

tweakmm

Lifer
May 28, 2001
18,436
4
0
#include<iostream.h>
#include<string.h>

void getInput(char &alpha , int &numeric);
//char processEverything(char &alph, int &num)
//void PrintOutput(final)

int main()
{
getInput(&alpha, &numeric);

//final = ProcessEverything(&alpha, &numberic)
//PrintOutput(final)

cin.sync();
cin.get();
return 0 ;

}

void getInput(&alpha, &numeric)
{
cout<<"What are the letters of the licence plate?";
cin>>alpha;
cout<<'\n'<<"What are the numbers?";
cin>>numeric;
}
 

Ameesh

Lifer
Apr 3, 2001
23,686
0
0
void getInput(char &alpha , int &numeric); is bad try it with * instead so void getInput(char *alpha,int * numeric)

 

tweakmm

Lifer
May 28, 2001
18,436
4
0


<< void getInput(char &alpha , int &numeric); is bad try it with * instead so void getInput(char *alpha,int * numeric) >>


ok, the reason I was trying to do that was because in my AP class they are teaching us to use the ampersand(&) Ill give it a try though. Thanks a TON!
 

Ameesh

Lifer
Apr 3, 2001
23,686
0
0
the ampersand operator gives you the address of the variable, a * is the address of a variable so int * foo = &bar; is a valid statement but you cant pass in a type your tring to get
 

yiwonder

Golden Member
Nov 30, 2000
1,185
0
0


<< int main()
{
getInput(&alpha, &numeric);

//final = ProcessEverything(&alpha, &numberic)
//PrintOutput(final)

cin.sync();
cin.get();
return 0 ;

}
>>



I don't see where you declared alpha and numeric... Which program are you using?

Edit:


<< void getInput(&alpha, &numeric) >>


Shouldn't it be:
void getInput(apstring (or whatever your string is...) &alpha,int &numeric)
 

yiwonder

Golden Member
Nov 30, 2000
1,185
0
0
To be completely and brutally honest, how did you get into AP? Just glancing over it, these are very simple errors.

Please note: I'm not flaming you, but maybe suggesting that you might want to do a quick "refresher".
 

tweakmm

Lifer
May 28, 2001
18,436
4
0


<< To be completely and brutally honest, how did you get into AP? Just glancing over it, these are very simple errors.

Please note: I'm not flaming you, but maybe suggesting that you might want to do a quick "refresher".
>>


I am writing this program kinda stressed out. I think that i am just going to re-write it.
 

yiwonder

Golden Member
Nov 30, 2000
1,185
0
0


<<

<< To be completely and brutally honest, how did you get into AP? Just glancing over it, these are very simple errors.

Please note: I'm not flaming you, but maybe suggesting that you might want to do a quick "refresher".
>>


I am writing this program kinda stressed out. I think that i am just going to re-write it.
>>


You've got a good start, it's just that you've missed a semicolon or two, forgot to declare your variables, and write the functions correctly. Don't get discouraged. You're idea is there, you just have to put it into the correct syntax. Stick with it.

Also, maybe you should take like a 10 minute break and come back fresh or something like that.
 

tweakmm

Lifer
May 28, 2001
18,436
4
0


<<

<<

<< To be completely and brutally honest, how did you get into AP? Just glancing over it, these are very simple errors.

Please note: I'm not flaming you, but maybe suggesting that you might want to do a quick "refresher".
>>


I am writing this program kinda stressed out. I think that i am just going to re-write it.
>>


You've got a good start, it's just that you've missed a semicolon or two, forgot to declare your variables, and write the functions correctly. Don't get discouraged. You're idea is there, you just have to put it into the correct syntax. Stick with it.

Also, maybe you should take like a 10 minute break and come back fresh or something like that.
>>


yeah, i just went out to dinner w/ my parents, so now i feel better, and its now time to get crackin'
thanks for the replies everybody
 

minus1972

Platinum Member
Oct 4, 2000
2,245
0
0


<< You've got a good start, it's just that you've missed a semicolon or two, forgot to declare your variables, and write the functions correctly. Don't get discouraged. You're idea is there, you just have to put it into the correct syntax. Stick with it. >>



I second this but I can explain where you're coming from. I just went back to class (AP Computer Science w/ C++) and I'm suffering from total brain freeze right now. It'll all come back though.

PS- DECLARE YOUR VARIABLES IN THE MAIN FUNCTION (wink wink nod wink)