Click here to Skip to main content
15,886,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: render a richedit control into a bit Pin
Rozis19-Jan-10 2:21
Rozis19-Jan-10 2:21 
QuestionHow to overlay an image on a printout Pin
mhorowit17-Jan-10 17:44
mhorowit17-Jan-10 17:44 
QuestionCopy Constructor in Singletonclass. Pin
Cpp_Com17-Jan-10 17:39
Cpp_Com17-Jan-10 17:39 
AnswerRe: Copy Constructor in Singletonclass. Pin
«_Superman_»17-Jan-10 17:57
professional«_Superman_»17-Jan-10 17:57 
GeneralRe: Copy Constructor in Singletonclass. Pin
Cpp_Com17-Jan-10 18:15
Cpp_Com17-Jan-10 18:15 
GeneralRe: Copy Constructor in Singletonclass. Pin
«_Superman_»17-Jan-10 18:20
professional«_Superman_»17-Jan-10 18:20 
AnswerRe: Copy Constructor in Singletonclass. Pin
Avi Berger17-Jan-10 18:12
Avi Berger17-Jan-10 18:12 
QuestionSimple input and output program that quits to soon. I cant find the problem, please take a look. Pin
rbwest8617-Jan-10 9:50
rbwest8617-Jan-10 9:50 
Hello all, I just wanted to post here because I can not figure this out. I run the program in debugging mode which does not help at all for this. Maybe I just dont know how to use the debugger correctly yet.

The program compiles without any errors, but after you enter your name the program exits. I dont understand it. I looked over the code time and time again and cant figure it out. So here is the very short code listed below. I appreciate any feedback on the obvious error with my program.

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

int main()
{
    
    //Global Declarations of Variables
double iovertime_hours=0; 
double iovertime_pay=0; 
double iovertime_extra=0;
int cname ;
int ihours ;
int iwage ;
    
	//Enter Employee Information
cout << "\n\nEnter the employee name = " ;
cin >> cname ;
cout << "Enter the hours worked  = ";
cin >> ihours ;
cout << "Enter his or her hourly wage = ";
cin >> iwage ; 

	// Determine if hours are greater than 40 
if (ihours > 40) 
	{
    //Do Calculations
		iovertime_hours=ihours+40;
		iovertime_pay=iwage-1.5 ;
		iovertime_extra=iovertime_hours*iovertime_pay;

		// Display Employee Details
		cout << "\n\n";
		cout << "Employee Name ............. = " << cname << endl ;
		cout << "Base Pay .................. = " << iwage*40 << endl ;
		cout << "Hours in Overtime ......... = " << iovertime_hours << endl ;
		cout << "Overtime Pay Amout......... = " << iovertime_extra << endl ;
		cout << "Total Pay ................. = " << iovertime_extra+(40*iwage) << endl;
	}    
else (ihours < 40); // Else hours are less than 40 hours
{
		cout << "\n\n";
		cout << "Employee Name ............. = " << cname << endl ;
		cout << "Base Pay .................. = " << iwage*40 << endl ;
		cout << "Hours in Overtime ......... = " << iovertime_hours << endl ;
		cout << "Overtime Pay Amout......... = " << iovertime_extra << endl ;
		cout << "Total Pay ................. = " << iovertime_extra+(40*iwage) << endl;
	} // End of the primary if statement
return 0;
} //End of Int Main


</pre>

AnswerRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Garth J Lancaster17-Jan-10 10:17
professionalGarth J Lancaster17-Jan-10 10:17 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
rbwest8617-Jan-10 10:25
rbwest8617-Jan-10 10:25 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Garth J Lancaster17-Jan-10 10:31
professionalGarth J Lancaster17-Jan-10 10:31 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Bram van Kampen17-Jan-10 10:31
Bram van Kampen17-Jan-10 10:31 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Garth J Lancaster17-Jan-10 10:38
professionalGarth J Lancaster17-Jan-10 10:38 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Bram van Kampen17-Jan-10 14:27
Bram van Kampen17-Jan-10 14:27 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Garth J Lancaster17-Jan-10 14:29
professionalGarth J Lancaster17-Jan-10 14:29 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Bram van Kampen17-Jan-10 14:45
Bram van Kampen17-Jan-10 14:45 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Luc Pattyn17-Jan-10 14:49
sitebuilderLuc Pattyn17-Jan-10 14:49 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Bram van Kampen17-Jan-10 15:04
Bram van Kampen17-Jan-10 15:04 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Luc Pattyn17-Jan-10 15:11
sitebuilderLuc Pattyn17-Jan-10 15:11 
AnswerRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
Avi Berger17-Jan-10 10:30
Avi Berger17-Jan-10 10:30 
GeneralRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
rbwest8617-Jan-10 11:03
rbwest8617-Jan-10 11:03 
AnswerRe: Simple input and output program that quits to soon. I cant find the problem, please take a look. Pin
rbwest8617-Jan-10 11:57
rbwest8617-Jan-10 11:57 
Questiona fscanf error in MFC SDI Pin
CHYGO17-Jan-10 9:47
CHYGO17-Jan-10 9:47 
AnswerRe: a fscanf error in MFC SDI Pin
Garth J Lancaster17-Jan-10 10:37
professionalGarth J Lancaster17-Jan-10 10:37 
GeneralRe: a fscanf error in MFC SDI Pin
CHYGO17-Jan-10 17:55
CHYGO17-Jan-10 17:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.