![]() |
|
#1
|
|||
|
|||
Need Quick Help!!I have a program that I need to make and it has structs. I keep getting a 'illegal use of this type as an expression' error. Please help, any help is very appreciated!
CPP / C++ / C Code:
|
|
#2
|
|||
|
|||
Re: Need Quick Help!!Quote:
The definition of Projectile tells the compiler that Projectile is a struct. You don't have any of them until your program declares variables of that type. Once you declare a variable of type Projectile, then you can use access its members. Also, since Projectile.speed is a float, you must have an input function that works with floats. cin.getline(...,...) works with strings, not floats. You could try something the following main() function, based on your code, with your definitions. It's a start, I hope. CPP / C++ / C Code:
Regards, Dave |
|
#3
|
|||
|
|||
Re: Need Quick Help!!Thanks, i will try it.
Thanks a million, that helped me out, I just couldnt decipher what it wanted me to do. |
|
#4
|
|||
|
|||
Re: Need Quick Help!!instead of my_projectile I used projectileData.
so what if I wanted to cin a Travel distance, would it be CPP / C++ / C Code:
|
|
#5
|
|||
|
|||
Re: Need Quick Help!!I am getting the same errors with the substructs, how do I do those?
CPP / C++ / C Code:
|
|
#6
|
|||
|
|||
Re: Need Quick Help!!Also I just noticed that my DisplayEntry was their twice, I deleted the entries from the main() function.
|
|
#7
|
|||
|
|||
Re: Need Quick Help!!Updated my code, I only get about 18 errors, most of which are the 'illegal use of this type as an expression' error with the SubStructs. This is an assignment which I have to turn-in in about 10 min. If I could figure out how to get rid of the 'illegal use of this type as an expression' errors, I would help greatly.
CPP / C++ / C Code:
|
|
#8
|
||||
|
||||
Re: Need Quick Help!!Hi Adam,
First, Change the Source definition like this: CPP / C++ / C Code:
Remove the target struct definition. Then, change the projectile definition like this: CPP / C++ / C Code:
Here are the variables that you should use in your functions: Code:
Regards, Paramesh. __________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#9
|
|||
|
|||
Re: Need Quick Help!!thanks, I will try that
|
Recent GIDBlog
Last Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Quick, Insertion, and Partition | silicon | CPP / C++ Forum | 0 | 18-May-2005 20:49 |
| Merge and Heap...which is really faster | silicon | CPP / C++ Forum | 0 | 10-May-2005 13:46 |
| Google toolbar 2.0 - Has popup blocker, Autofill and quick weblog posting features | jrobbio | Computer Software Forum - Windows | 11 | 26-Jun-2003 08:20 |
| Dave's Quick Search Taskbar Toolbar Deskbar | jrobbio | Computer Software Forum - Windows | 2 | 03-Apr-2003 07:42 |
| A quick way to CHMOD | jrobbio | Web Hosting Forum | 0 | 16-Feb-2003 13:02 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The