[Warning] ISO C requires whitespace after the macro name - #include <iostream>
-
#include <iomanip>
-
#include <cmath>
-
#include <fstream>
-
-
#define a=5.5 // 1
-
#define b=6 // 2
-
#define c=7 // 3
-
#define d=9 // 4
-
#define e=12 //Rate 5
-
-
#define USE_PAUSE 0 // set to 1 to add a pause at the end of the program
-
#define DEBUG 1 // set to 1 to enable debug prints and disable clear screen
-
using namespace std;
-
/******************************* main *******************************/
-
-
int main()
-
{
-
char part_desc[26],
-
drive[2], // user output drive
-
disk_file[15], // full name and destination of output file
-
file[9]; // user output file name
-
-
ofstream outfile; // output stream name
-
-
unsigned int choice, // user output choice
-
-
//Program Declarations
-
ID, clas, time, //ID number, classification, worked hour
-
overtime; //overtimed hours of work
-
float rate, pay, //hourly rate, Regular Pay of 40-hours
-
overpay, total; //pay from overtimed hours of work, Total Earning
-
-
string name; //name of Employee
-
-
/******************* INPUT SECTION **********************/
-
#if DEBUG
-
cout << "Starting INPUT SECTION" << endl;
-
#endif
-
-
cout<< "[Enter] Employee's name: "; cin>>name; /*Employee's name */
-
cout<< "[Enter] Employee's ID: "; cin>>ID; /*Employee's ID */
-
cout<< "[Enter] Employee's Job Class: "; cin>>clas; /*Employee's class*/
-
cout<< "[Enter] Employee's # of Hours: ";cin>>time; /*Employee's hour */
-
-
/***************** PROCESSING SECTION *******************/
-
#if DEBUG
-
cout << "Starting PROCESSING SECTION" << endl;
-
#endif
-
-
//Classification //Regular Pay
-
rate = clas==1 ? a; pay = 40 * rate;
-
rate = clas==2 ? b; //Overtime hours //Total Earnings
-
rate = clas==3 ? c; overtime = time-40; total = overpay + pay;
-
rate = clas==4 ? d; //Overpay
-
rate = clas==5 ? e; overpay = overtime * (rate * 1.5);
-
rate = clas!=1|2|3|4|5 ? a;
-
-
/******************* OUTPUT SECTION *********************/
-
#if DEBUG
-
cout << "Starting OUTPUT SECTION" << endl;
-
#endif
-
-
cout<< "WorkHard Corporation\n" << "====================\n\n"
-
<< "Employee Name: "<< name<< "ID. Number: "<< ID << "\n\n" /*name & ID*/
-
<< "Job Classification: "<< clas /*class*/
-
<< "Hourly Rate: "<< setprecision(2) << fixed<< rate
-
<< "Total Hours Worked: "<< time
-
<< "Overtime Hours: "<< overtime << "\n\n"
-
-
<< "Regular Pay: "<< setprecision(2)<< fixed<< pay
-
<< "Overtime Pay: "<< setprecision(2)<< fixed<< overpay<< "\n\n"
-
-
<< "Total Earning: "<< setprecision(2)<< fixed<< total<< "\n\n";
-
-
if (hour < 40)
-
cout<< "Inadequate number of hours worked!";
-
else if (hour > 60)
-
cout<< "Excessive number of hours Worked!";
-
-
system ("pause");
-
-
/*********************** output―Locator ***********************/
-
#if !DEBUG
-
system ("cls");
-
#endif
-
-
cout << "Output to console (1) or disk file (2): ";
-
cin >> choice;
-
-
/**/ if ( choice == 1 )
-
/**/{
-
/**/ #if !DEBUG
-
/**/ system ("cls");
-
/**/ #endif
-
/**/ outfile.open("con");
-
/**/}
-
/**/ else
-
/**/{
-
/**/ cout << "Which drive: a, b, c, d, e, or f ? ";
-
/**/ cin >> drive;
-
/**/ strcpy(disk_file, drive);
-
/**/ strcat(disk_file, ":");
-
/**/ cout << "Enter a results file name: ";
-
/**/ cin >> file;
-
/**/ strcat(disk_file, file);
-
/**/ strcat(disk_file, ".txt");
-
/**/ outfile.open(disk_file);
-
/**/}
-
-
outfile << setiosflags(ios::showpoint | ios::fixed) << setprecision(2);
-
-
/**/outfile <<setw(53)<< "Mini Calculator\n\n"
-
/**/<<setw(24)<<"Operand 1"<<setw(48)<<"Operand 2\n"
-
/**/<<setw(24)<< op<<setw(47)<< op2<< "\n\n"
-
-
/**/<<setw(10)<< "Sum"<<setw(17)<< "Difference"<<setw(14)<< "Product"
-
/**/<<setw(21)<< "Whole Quotient"<<setw(16)<< "Remainder\n"
-
/**/<<setw(10)<< op+op2<<setw(17)<< op-op2<<setw(14)<< op*op2
-
/**/<<setw(21)<< op/op2<<setw(15)<< op%op2<< "\n\n\n"
-
-
/**/<<setw(14)<<"Real Quotient"<<setw(31)<<"Square Root of Operand 1"
-
/**/<<setw(34)<<"Operand 2 to the power of 4"
-
/**/<<setw(15)<<setprecision(2)<<fixed<< float(op)/op2
-
/**/<<setw(31)<< sqrt(op)
-
/**/<<setw(34)<< int(pow(op2,4.0))<< "\n\n";
-
-
outfile.close();
-
system ("cls");
-
return 0;
-
}
-
So what's the //1 for?
It's not part of the macro and the macro is not C++.
Remember, all lines beginning with a # belong to the preprocessor so you need to follow preprocessor rules n those lines
You will need to fix the other #define's as well.
2 15253
So what's the //1 for?
It's not part of the macro and the macro is not C++.
Remember, all lines beginning with a # belong to the preprocessor so you need to follow preprocessor rules n those lines
You will need to fix the other #define's as well.
outfile is ignored; I require help with rate = clas==1 ? a; and other conditionals.
alright
mm..no error to the commentaries.
I assume it's the conditionals; maybe, the compiler doesn't know them.
#define(d) variables are old? It worked for my calculator program lol
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jim |
last post by:
Im trying to find the error in this statement:
CREATE PROCEDURE STP_selectmain
AS
select a.inventoryid, b.firstname, b.lastname, art.title, art.medium,
a.cost, a.inventoryid,...
|
by: D Senthil Kumar |
last post by:
Hi,
Is it possible to get the name of the macro from that macro itself.
Thank you in advance.
|
by: sounak |
last post by:
How could we get a macro name from a macro value
such that
in a header file
#define a 100
#define b 200
now the source file will be such that
the user gives 100
then the value is outputted as...
|
by: aspineux |
last post by:
I want to parse
'foo@bare' or '<foot@bar>' and get the email address foo@bar
the regex is
r'<\w+@\w+>|\w+@\w+'
now, I want to give it a name
|
by: elecooley |
last post by:
Baically, myself and the person I sit next to use a shortcut to an Excel file. The Excel file has multiple macros. When office mate opens it, it works fine (ie all macros run, excel file gets data,)....
|
by: Jeff |
last post by:
I am receiving the following error:
// error: System.Net.Mail.SmtpException: The SMTP server requires a
secure connection or the client was not authenticated. The server
response was: 5.7.0 No...
|
by: ChipR |
last post by:
I'm using
strFileName = "\\serverName\folderName\fileName.txt"
If Dir(strFileName) > "" Then
...
This worked fine for me, even when I disconnected from the network, but when a user ran it on...
|
by: James Lucero |
last post by:
Below is my code. The error is "Compile Error Variable not defined". wdOrientLandscape is highlighted. Again this the portion of the code from a VB module created in Excel. The previous lines of code...
|
by: Harshini Raj |
last post by:
Hi,
I am unable to fix this error. Canyou tell me what compiler options i have to use to fix this issue?
Issue Error 40:Undeclared identifier 'Name' -- Within an expression, an identifier was...
|
by: mahmoodn |
last post by:
Hi,
I have a struct with this definition
struct SeverityAction : public Action {
uint32_t theSeverity; //*****
public:
SeverityAction(uint32_t aSeverity);
...
};
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |