Hello I am new to scripting (very new) and I am encountering many issues that I am having trouble identiying.
The script is as follows:
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include <iostream>
#include <cmath>
using namespace std;
class verify{
public:
int ver(int x){
while ( ! (cin >> x)){
cout << "Error. Try again: ";
cin.clear ();
cin.ignore (1000, '\n');
}
}
}
int main(){
int input;
double due, pay, stilldue, absvalue, pay2, stilldue2;
ver obj;
cout << "Each Movie is $10." << endl;
cout << "Please enter in how many you want:";
cin >> input;
obj.ver(input);
due = input * 10;
cout << "$" << due << " is due." << endl;
cout << "Please insert money:";
cin >> pay;
obj.ver(pay);
stilldue = due - pay;
while(stilldue > 0){
cout << "Please insert $" << stilldue << endl;
cin >> pay2;
obj.ver(pay2);
stilldue = stilldue - pay2;
}
if(stilldue < 0){
absvalue = abs (stilldue);
cout << "Here is $" << absvalue << " back" << endl;
cout << "thank you";
}
else if (stilldue == 0){
cout << "thank you";
}
return 0;
}
|
I keep getting these errors:
||In member function 'int verify::ver(int)':|
|13|warning: no return statement in function returning non-void|
|5|error: new types may not be defined in a return type|
|5|note: (perhaps a semicolon is missing after the definition of 'verify')|
|16|error: two or more data types in declaration of 'main'|
||=== Build finished: 2 errors, 1 warnings ===|
I've done some research but I still cannot understand what I'm doing wrong. Sorry, I haven't messed with coding much before, any help or explanations would be appreciated.