Hello i was wondering you can help me.Every time i try to make my own function so i can get user input it fails and doesnt compile.Example of my failed code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include "stdafx.h"
#include <iostream>
using namespace std;
typedef unsigned short USHORT;
USHORT Find(Mass , Velocity)
int main()
{
USHORT onemass;
USHORT onevelocity;
USHORT Total;
cout << "What is your velocity?\n";
cin >> velocity;
cout << "what is your mass?";
cin >> mass;
Total = Find(onemass,onevelocity);
cout << "your total is:";
cout << Total;
cin.get();
return 0;
}
USHORT Find(USHORTMmass,USHORT Veocity)
{
cin.get();
return mass * velocity;
}
|
Can you help and tell me how i can i remember the right way in doing this
btw compile error
------ Build started: Project: latest function practice, Configuration: Debug Win32 ------
latest function practice.cpp
latest function practice.cpp(5): error C2065: 'Mass' : undeclared identifier
latest function practice.cpp(5): error C2065: 'Velocity' : undeclared identifier
latest function practice.cpp(7): error C2448: 'Find' : function-style initializer appears to be a function definition
latest function practice.cpp(15): error C2065: 'velocity' : undeclared identifier
latest function practice.cpp(18): error C2065: 'mass' : undeclared identifier
latest function practice.cpp(20): error C3861: 'Find': identifier not found
latest function practice.cpp(29): error C2065: 'USHORTMmass' : undeclared identifier
latest function practice.cpp(29): error C2275: 'USHORT' : illegal use of this type as an expression
latest function practice.cpp(4) : see declaration of 'USHORT'
latest function practice.cpp(29): error C2146: syntax error : missing ')' before identifier 'Veocity'
latest function practice.cpp(29): error C2078: too many initializers
latest function practice.cpp(29): error C2275: 'USHORT' : illegal use of this type as an expression
latest function practice.cpp(4) : see declaration of 'USHORT'
latest function practice.cpp(29): error C2059: syntax error : ')'
latest function practice.cpp(30): error C2143: syntax error : missing ';' before '{'
latest function practice.cpp(30): error C2447: '{' : missing function header (old-style formal list?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========