Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,395 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,125 people online right now. Registration is fast and FREE... Join Now!




Business Card Program

 
Reply to this topicStart new topic

Business Card Program

eadams20
30 Aug, 2006 - 03:09 PM
Post #1

D.I.C Head
**

Joined: 30 Aug, 2006
Posts: 65


My Contributions
CODE
[//************************************************** ************************
// Business Card Program
// This program prints 8 business cards in two rows
//************************************************** ************************

#include <iostream>
#include <string>
using namespace std;

const string BUSINESS = "HomemakersRus"; //Define a line of Business Name
const string NAME = "Emily Adams"; //Define a line of first and last name
const string ADDRESS = "555 Doeville"; //Define a line of Address
const string PHONE = "555-555-5555"; //Define a line of phone number
const string SPACE = " "; // Define a line of space

int main ()
{
string businessRow; // A row beginning with Business Name
string nameRow; // A row beginning with Name
string addressRow; // A row beginning with Address
string phoneRow; // A row beginning with Phone
string spaceRow; // A row beginning with space

// Create a businessRow by concatenating the basic strings
businessRow = BUSINESS + SPACE + BUSINESS;
nameRow = NAME + SPACE + NAME;
addressRow = ADDRESS + SPACE + ADDRESS;
phoneRow = PHONE + SPACE + PHONE;

// Print 4 rows buiness-name-address-phone
cout << businessRow << endl;
// Print 4 rows buiness-name-address-phone
cout << nameRow << endl;
// Print 4 rows buiness-name-address-phone
cout << addressRow << endl;
// Print 4 rows buiness-name-address-phone
cout << phoneRow << endl;
cout << spaceRow << endl;

// Print 4 rows buiness-name-address-phone
cout << businessRow << endl;
// Print 4 rows buiness-name-address-phone
cout << nameRow << endl;
// Print 4 rows buiness-name-address-phone
cout << addressRow << endl;
// Print 4 rows buiness-name-address-phone
cout << phoneRow << endl;
cout << spaceRow << endl;

// Print 4 rows buiness-name-address-phone
cout << businessRow << endl;
// Print 4 rows buiness-name-address-phone
cout << nameRow << endl;
// Print 4 rows buiness-name-address-phone
cout << addressRow << endl;
// Print 4 rows buiness-name-address-phone
cout << phoneRow << endl;
cout << spaceRow << endl;


// Print 4 rows buiness-name-address-phone
cout << businessRow << endl;
// Print 4 rows buiness-name-address-phone
cout << nameRow << endl;
// Print 4 rows buiness-name-address-phone
cout << addressRow << endl;
// Print 4 rows buiness-name-address-phone
cout << phoneRow << endl;
cin.get(); //type enter to end

return 0;
}]

This is a code I did for business cards. I had to make 8 of them. 2 across and 4 down. I got it correctly done, but not sure if it is what I am suppose to do. Can you tell me if this is acceptable code or do I need to do more research LOL..

Thanks in Advance.. I am new and Confused!
Emily

This post has been edited by Dark_Nexus: 30 Aug, 2006 - 04:06 PM
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Business Card Program
30 Aug, 2006 - 03:22 PM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,230



Thanked: 40 times
Dream Kudos: 25
My Contributions
It's acceptability should be determined by whether or not it meets the paramters of your assignment. Does it meet all the provisions given to you?

There are certainly ways of doing it differently, but perhaps no reason. If it does what it's supposed to do based on the original assignment, then I would think it's acceptable.
User is offlineProfile CardPM
+Quote Post

eadams20
RE: Business Card Program
30 Aug, 2006 - 05:06 PM
Post #3

D.I.C Head
**

Joined: 30 Aug, 2006
Posts: 65


My Contributions
Here is my assignment instructions "write a program that prints out business cards for yourself. To save paper, the program should print 8 cards per page, 2 columns of 4. to reduce typing declare a named string constant for each line, and write output statements to print the 8 cards using those constants. Be sure to include appropriate comments in your code, choose meaningful identifiers and use identataion"

Thanks for you help.
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Business Card Program
30 Aug, 2006 - 05:23 PM
Post #4

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,230



Thanked: 40 times
Dream Kudos: 25
My Contributions
In that case, your program meets the asignment parameters in the following ways:

It does print two rows of four business cards, although you may want to use the formatting capabilities of the cout operator to ensure that everything lines up on screen.

It does use string constants, and is adequately commented.

It does not appear to be indented, but that is often a function of copying and pasting to this forum, so it may well be indented in your version.

Looks fine! smile.gif
User is offlineProfile CardPM
+Quote Post

eadams20
RE: Business Card Program
30 Aug, 2006 - 06:05 PM
Post #5

D.I.C Head
**

Joined: 30 Aug, 2006
Posts: 65


My Contributions
Thanks soooo much for all your help!!!!!
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/5/08 02:46AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month