codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  New to C++, can anyone help me out?  jackmarathon at 13:11 on Wednesday, June 07, 2006
 

This is the first program I am writing for a C++ class I am taking. Can Anyone tell me what is wrone with it?


//A program that figures Net Pay
#include "stdafx.h"
#include<iostream>
using namespace std;
int main()
{
double hourlyWage;
double hoursWorked;
double withholdingPercentage;
cout<<"Please enter your hourly wage ";
cin>>hourlyWage;
cout<<"Please enter the number of hours worked ";
cin>>hoursWorked;
cout<<"Please enter the withholding percentage ";
cin>>withholdingPercentage;

cout<<"Your net pay is ";
cout<<hourlyWage*hoursWorked-withholdingPercentage%<<end1;
}


  Re: New to C++, can anyone help me out?  jackmarathon at 13:54 on Wednesday, June 07, 2006
 

ok, so i changed the program to look like this:

//A program that figures Net Pay
#include "stdafx.h"
#include<iostream>
using namespace std;
int main()
{
double hourlyWage;
double hoursWorked;
double withholdingPercentage;
cout<<"Please enter your hourly wage ";
cin>>hourlyWage;
cout<<"Please enter the number of hours worked ";
cin>>hoursWorked;
cout<<"Please enter the withholding percentage ";
cin>>withholdingPercentage;

cout<<"Your net pay is "<<hourlyWage*hoursWorked-withholdingPercentage<<end1;
}


and it actually runs, but it says that end1 is an undeclaired identifier. I also need the withholding percentage to actually be a percentage, how do I do that? another problem is that the program goes off the screen too quickly for my to read the output.

  Re: New to C++, can anyone help me out?  Guroo at 15:39 on Monday, June 12, 2006
 

First, your end1 should be endl (ENDL).

Second, you can do your math for the percent conversion in your variable call. I can't remember the number to % math right now, get back to be later if you still can't find it.

Third, the easy way to get your screen to stay open so you can see your output is to add system ("pause"); just before the return 0;










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime
•  help me
•  pls help me with this..
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007