I need to be able to pass the data I enter into my check. I do not think I have my check set up right though. I will post my code.

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

string todaysDate;
string firstName;
string lastName;
double amount;

void enterData();
void printCheck();


int _tmain(int argc, _TCHAR* argv[])

{
	enterData();
	printCheck();

	return 0;
}

void enterData()
{


    cout << "Enter today's date: ";
	cin  >> todaysDate;
	cout << "Enter the first name: ";
	cin  >> firstName;
	cout << "Enter the last name: ";
	cin  >> lastName;
	cout << "Enter the amount: ";
	cin  >> amount;
}

void printCheck()
{
    cout << "Zzyz Corp                                      Date: (today's date)"<<endl;
	cout << "1164 Sunrise Avenue                                        "<<endl;
	cout << "Kalispell, Montana\n                                         "<<endl;

	cout << "Pay to the order of: (string firstName lastName)      $ (amount)\n "<<endl;
	
    	

	cout << "UnderSecurity Bank                                         "<<endl;
	cout << "Missoula, MT                                               "<<endl;
	cout << "                                                ____________________"<<endl;
	cout << "                                                Authorized Signature";

	cout << endl << endl;
	
}

Recommended Answers

All 3 Replies

you mean like this?

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;


void enterData(string &todaysDate, string& firstName, string& lastName, double& amount);
void printCheck(string &todaysDate, string& firstName, string& lastName, double& amount);


int _tmain(int argc, _TCHAR* argv[])

{
    string todaysDate;
    string firstName;
    string lastName;
    double amount;
	enterData(todaysDate, firstName, lastName, amount);
	printCheck(todaysDate, firstName, lastName, amount);

	return 0;
}

void enterData(string &todaysDate, string& firstName, string& lastName, double& amount)
{


    cout << "Enter today's date: ";
	cin  >> todaysDate;
	cout << "Enter the first name: ";
	cin  >> firstName;
	cout << "Enter the last name: ";
	cin  >> lastName;
	cout << "Enter the amount: ";
	cin  >> amount;
}

void printCheck(string &todaysDate, string& firstName, string& lastName, double& amount)
{
    cout << "Zzyz Corp                                      Date: (today's date)"<<endl;
	cout << "1164 Sunrise Avenue                                        "<<endl;
	cout << "Kalispell, Montana\n                                         "<<endl;

	cout << "Pay to the order of: (string firstName lastName)      $ (amount)\n "<<endl;
	
    	

	cout << "UnderSecurity Bank                                         "<<endl;
	cout << "Missoula, MT                                               "<<endl;
	cout << "                                                ____________________"<<endl;
	cout << "                                                Authorized Signature";

	cout << endl << endl;
	
}

Well I am supposed to use global variables and have no input parameters. I can enter the data but i'm not sure how I can get it to display on the check itself.

Ok I figured everthing out except: 1) when it asks for my input it asks like this Enter first name: Enter last name: Enter amount:-it puts it all on the same line. Also when I run it it puts Sept. on the in the right spot but it puts 30, 2007 in the pay to the order slot. Any ideas?

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

string todaysDate;
string firstName;
string lastName;
double amount;

void enterData();
void printCheck();


int _tmain(int argc, _TCHAR* argv[])

{
	enterData();
	printCheck();

	return 0;
}

void enterData()
{


    cout << "Enter today's date: ";
	cin  >> todaysDate;
	cout << "Enter the first name: ";
	cin  >> firstName;
	cout << "Enter the last name: ";
	cin  >> lastName;
	cout << "Enter the amount: ";
	cin  >> amount;

	cout << endl << endl;
}

void printCheck()
{
    cout << "Zzyz Corp                                      Date:     "<< todaysDate <<endl;
	cout << "1164 Sunrise Avenue                                        "<<endl;
	cout << "Kalispell, Montana\n                                         "<<endl;

	cout << "Pay to the order of:" << firstName << lastName <<      "$" << amount << endl;
	
    	

	cout << "UnderSecurity Bank                                         "<<endl;
	cout << "Missoula, MT                                               "<<endl;
	cout << "                                                ____________________"<<endl;
	cout << "                                                Authorized Signature";

	cout << endl << endl;
	
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.