Using c++:
Your application will read in from the user an employee's name and salary, and print out a Console Check similar to the following. Your newly modified check printing application will this time accommodate names and numbers of different lengths WITHOUT pushing the left or right hand side of the check out of whack. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > | $1,000,000 | > > > > ___Pay to the Order of___ Johnny PayCheck > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#include<iostream>
#include<string.h>
using namespace std;
void print(int s,int i)
{
if(s==0 && i==0)cout<<"0";
if (s==0)
return;
print(s/10,i+1);
//cout<<i<<endl;
if(i%3==0 &&
i!=0)cout<<s%10<<",";
else cout<<s%10;
}
int main()
{
int salary;
string name;
//taking inputs.
cout<<"Enter Name:";//asking name
getline(cin,name);//storing
cout<<"Enter ur salary in dollars:";
cin>>salary;
int i;
//can handle variable length strings
cout<<">>>>>>>>>>>>>>>>>>>>>>";
for(i=0;i<=name.size();i++)cout<<">";
cout<<">>>>>>>>>>>>>>>
";
cout<<"> | $";
print(salary,0);
cout<<" | > > > >\n";
cout<<"___Pay to the Order of___
"<<name<<" PayCheck > \n";
cout<<">>>>>>>>>>>>>>>>>>>>>>";
for(i=0;i<=name.size();i++)cout<<">";
cout<<">>>>>>>>>>>>>>>
";
return 0;
}
output:-
Get Answers For Free
Most questions answered within 1 hours.