Hi everyone,

I have created a program with my whole day and night hard work in dev C++ and now im trying the same code in Visual Studio C++ 6.0 ...

I'm showing you the code of that program, kindly guide me through this, or correct the problem in getting with;

# include <iostream>
# include <string>
#include <iomanip>
#include <stdio.h>
#include <cstdio>
#include <cassert>
#include <fstream>
# include <math.h>
# include <conio.h>
# include <stdlib.h>

using namespace std;
using std::string;

string welcome1();
void welcome2(string n);
int menu();
bool SaleR();
bool Cus();
bool Check();
bool Mile();
void thnk();

int main()
{
    cout.setf(ios_base::fixed, ios_base::floatfield);
    cout.precision(2);
    string nam;

    nam = welcome1();
    welcome2(nam);
    system("pause");
    int selection,val;  
    //man:
    do
    {

        if (selection==1)
        {
            //cout<<"1 selection ="<<selection;
            val=SaleR();
        }
        if (selection==2)
        {
            //cout<<"2 selection ="<<selection;
            val=Cus();
        }
        if (selection==3)
        {
            //cout<<"3 selection ="<<selection;
            val=Check();
        }
        if (selection==4)
        {
            //cout<<"4 selection ="<<selection;
            val=Mile();
        }
        selection=menu();
        //cout<<"0 selection ="<<selection;
        if (selection==0)
        {
            //cout<<"1 selection ="<<selection;
            thnk();
        }
    }
    while (selection > 0);
    return 0;
}
string welcome1()
{
    string n;
    system("cls");
    cout << "______________________________________________" << endl;
    cout << "______________________________________________" << endl;
    cout << "____                                      ____" << endl;
    cout << "____             W E L C O M E            ____" << endl;
    cout << "____                                      ____" << endl;
    cout << "____             T O   MAJID            ____" << endl;
    cout << "____                                      ____" << endl;
    cout << "____               F I N A L              ____" << endl;
    cout << "____                                      ____" << endl;
    cout << "____             P R O G R A M            ____" << endl;
    cout << "____                                      ____" << endl;
    cout << "______________________________________________" << endl;
    cout << "______________________________________________" << endl;  
    cout<< endl << endl << endl;

    cout << "Enter your first name : " ;
    cin >> n;
    cout<< endl << endl << endl;
    return n;
}

void welcome2(string n)
{    
    int len = strlen(n.c_str())-1;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@                                      @@@@" << endl;
    cout << "@@@@             W E L C O M E            @@@@" << endl;
    cout << "@@@@                                      @@@@" << endl;
    cout << "@@@@"<<setw(17+len)<<n<<setw(21-len)<<" "<<"@@@@" << endl;
    cout << "@@@@                                      @@@@" << endl;
    cout << "@@@@             M A Y   T H E            @@@@" << endl;
    cout << "@@@@                                      @@@@" << endl;
    cout << "@@@@            C O M P U T E R           @@@@" << endl;
    cout << "@@@@                                      @@@@" << endl;
    cout << "@@@@            G O D S  H A V E          @@@@" << endl;
    cout << "@@@@                                      @@@@" << endl;
    cout << "@@@@                M E R C Y             @@@@" << endl;
    cout << "@@@@                                      @@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl; 
    cout<< endl;
}
int menu()
{
    int a;
    //system("cls");

    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@                          @@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@      C M P S C 1 0 1     @@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@ F I N A L  P R O J E C T @@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@                          @@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@                                                         @@@@" << endl;
    cout << "@@@@                                                         @@@@" << endl;
    cout << "@@@@ OPTION     DESCRIPTION                                  @@@@" << endl;
    cout << "@@@@---------------------------------------------------------"<<"@@@@" << endl;
    cout << "@@@@   1."<<setw(10)<<"       Calculate sales tax on multiple sales items  "<<"@@@@" << endl;
    cout << "@@@@                                                         "<<"@@@@" << endl;
    cout << "@@@@   2."<<setw(10)<<"       Create a customer contact card               "<<"@@@@" << endl;
    cout << "@@@@                                                         "<<"@@@@" << endl;
    cout << "@@@@   3."<<setw(10)<<"       Balance a checkbook                          "<<"@@@@" << endl;
    cout << "@@@@                                                         "<<"@@@@" << endl;
    cout << "@@@@   4."<<setw(10)<<"       Trip Mileage Report                          "<<"@@@@" << endl;
    cout << "@@@@                                                         "<<"@@@@" << endl;
    cout << "@@@@   0."<<setw(10)<<"       Exit                                         "<<"@@@@" << endl;
    cout << "@@@@                                                         "<<"@@@@" << endl;
    cout << "@@@@                                                         "<<"@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout<< endl;

    cout << "Enter your selection here: " ;
    cin >> a;
    cin.ignore(1,' ');
    cout<< endl << endl << endl;
    return a;
}
bool SaleR()
{
     string Cont;
      do
      {
      system("cls");
      float hval,istval,isp,ival,gtot;
      string nm;
      isp=0.00;
      int a=1;

      float isTotval=0.00;
      cout<<"****************************************************************************"<<endl;
      cout<<"*                 S A L E S  R E C E I P T  P R O G R A M                  *"<<endl;
      cout<<"*                                                                          *"<<endl;
      cout<<"*  This program will print out a detailed reciept that will display......  *"<<endl;
      cout<<"*       1:  the name of item followed by price                             *"<<endl;
      cout<<"*       2:  the total sales price                                          *"<<endl;
      cout<<"*       3:  the amount of sales tax                                        *"<<endl;
      cout<<"*       4:  the total purchase price                                       *"<<endl;
      cout<<"****************************************************************************"<<endl;
      system("pause");
      cout <<"\n";
      cout <<"\n";
      cout <<"\n";  
      cout<<"Enter in the number of sales items to be calculated : ";
      cin>>hval;
      float vl[100];
      string nam[100];

      for (int i=0;i<hval;i++)
      {

          cout<<"Enter in the name of sales item number "<<a<<" : ";
          cin>>nm;
          nam[a]=nm;

          cout<<"Enter in the price of the "<<nm<<" : $";
          cin>>ival;
          vl[a]=ival;
          a=a+1;
          isTotval=isTotval+ival;
      } 
      cout <<"\n";
      cout <<"\n";
      cout <<"\n";  

      cout <<"Enter in the sales tax percentage <Enter 10 for 10%>: ";
      cin>>istval;
      isp=(istval*10/100)*hval;
      gtot = isTotval+isp;
      a=1;
      cout<<"\n";
      cout<<"\n";
      cout<<"\n"; 
      cout<<"********************************************************"<<endl;
      cout<<"************* R E C E I P T  O F  S A L E S ************"<<endl;
      cout<<"********************************************************"<<endl;
      cout<<"**              **              **                    **"<<endl;
      cout << "**  "<<"Item Names  **"<<setw(23)<<"**  Price"<<setw(15)<<"**"<< endl;
      cout<<"********************************************************"<<endl;
      for (int n=0;n<hval;n++)
      {
      int len = strlen(nam[a].c_str())-1;
      cout << "**  "<<nam[a]<<setw(28-len) << "$" << setw(9) << vl[a]<<setw(14)<<"**"<< endl;
        a=a+1;
      }
      cout<<"********************************************************"<<endl;
      cout << "**  Total Sales"<<setw(18) << "$" << setw(9) << isTotval << setw(14)<<"**"<< endl;
      cout << "**  Sales Tax"<<setw(20) << "$" << setw(9)<< isp << setw(14)<<"**"<< endl;
      cout << "**"<<setw(40) << "---------"<< setw(14)<<"**"<< endl;
      cout << "**  Grand Total"<<setw(18) << "$" << setw(9)<< gtot << setw(14)<<"**"<< endl;
      cout<<"**                                                    **"<<endl;
      cout<<"********************************************************"<<endl;
      cout<<"********************************************************"<<endl;
      cout<<"\n";
      cout<<"\n";
      cout <<"\n" << " Do you wants to run this program again? (Y/N):";
      //getline(cin, Cont);
          cin  >> Cont;

      }
      while (Cont=="Y" || Cont=="y"); 
      if (Cont=="N" || Cont=="n")
      {
         return 0;
      }
}
bool Cus()
{
     string Continue;
      do
      {
          system("cls");
          string nm,Sadd,ph,stat,cty,zc,fn;
          string fName, mName, lName;
          char first,last;

          cout<<"**********************************************************"<<endl;
          cout<<"*    C U S T O M E R   I N F O R M T I O N   F O R M     *"<<endl;
          cout<<"**********************************************************"<<endl;
          //system("pause");
          cout <<"\n";
          cout <<"\n";
          cout <<"\n";  
          //cin>>lInitial;
          cout<<"Enter in the Customer Full Name : ";
          getline(cin, nm);

          int s = nm.find(' ');
          fn=nm.substr(0,s);
          first = nm[0];
          if (s>0)
             last = nm[s+1];

          cout <<"\n";          
          cout<<"Enter in the Customer Stree Address : ";
          getline(cin, Sadd);
          cout <<"\n";

          cout<<"Enter in the Customer City : ";
          getline(cin, cty);
          cout <<"\n";

          cout<<"Enter in the Customer State : ";
          getline(cin, stat);
          cout <<"\n";

          cout<<"Enter in the Customer Zip Code : ";
          getline(cin, zc);
          cout <<"\n";

          cout<<"Enter in the Customer Phone No : ";
          getline(cin, ph);
          cout <<"\n";
          cout <<"\n";
          int len = strlen(nm.c_str())-1;
          int len2 = strlen(Sadd.c_str())-1;
          int len3 = ((strlen(cty.c_str())+strlen(stat.c_str())+strlen(zc.c_str()))+4)-1;
          int len4 = strlen(ph.c_str())-1;
          int len5 = sizeof(first)+sizeof(last);
          //cout<<len3<<" ssd"<<endl;
          cout<<fn<<"'s contact card will look as follows:"<<endl;
          cout<<"********************************************************"<<endl;
          cout<<"******* C U S T O M E R  C O N T A C T  C A R D ********"<<endl;
          cout<<"********************************************************"<<endl;
          cout<<"*******"<<setw(23)<<first<<" "<<last<<setw(26-len5)<<"********"<<endl;
          cout<<"********************************************************"<<endl;
          cout<<"**  "<<nm<<setw(51-len)<<"**"<< endl;
          cout<<"**  "<<Sadd<<setw(51-len2)<<"**"<< endl;
          cout<<"**  "<<cty<<", "+stat<<"  "<<zc<<setw(51-len3)<<"**"<< endl;
          cout<<"**  "<<ph<<setw(51-len4)<<"**"<< endl;
          cout<<"********************************************************"<<endl;
          cout<<"\n";
          cout<<"\n";
          cout <<"\n" << " Do you wants to run this program again? (Y/N):";
          getline(cin, Continue);
      }
      while (Continue=="Y" || Continue=="y"); 
      if (Continue=="N" || Continue=="n")
      {
         return 0;
      }
}
bool Check()
{
     string Continue;
      do
      {

          string nm;

          int a,amt,bl=0,lwid=0;
          int d=0,c=0;
          int dep[25];
          int wid[25];
          int bal[25];
          abc:
          system("cls");
          cout <<"\n";
          cout<<"**********************************************************"<<endl;
          cout<<"*    A C C O U N T   I N F O R M T I O N   F O R M       *"<<endl;
          cout<<"**********************************************************"<<endl;
          cout <<"**          OPTION               DESCRIPTION            **" << endl;
          cout <<"**------------------------------------------------------"<<"**" << endl;
          cout <<"**   1."<<setw(10)<<"       Cash Deposit"<<setw(30)<<"       "<<"**" << endl;
          cout <<"**                                                      "<<"**" << endl;
          cout <<"**   2."<<setw(10)<<"       Cash Withdwarl"<<setw(28)<<"       "<<"**" << endl;
          cout <<"**                                                      "<<"**" << endl;
          cout <<"**   3."<<setw(10)<<"       Balance Sheet"<<setw(29)<<"       "<<"**" << endl;
          cout <<"**                                                      "<<"**" << endl;
          cout <<"**   0."<<setw(10)<<"       Return Main Menu"<<setw(26)<<"       "<<"**" << endl;
          cout <<"**                                                      "<<"**" << endl;
          cout <<"**********************************************************" << endl;
          cout<< endl;

          cout << "Enter your Account Transction: " ;
          cin >> a;
          cin.ignore(1,' ');
          cout <<"\n";
          if (a==3)
          {
             system("cls");
             string z;

             cout<<"***********************************************************"<<endl;
             cout<<"******* C H E C K B O O K  B A L A N C E S H E E T ********"<<endl;
             cout<<"***********************************************************"<<endl;
             cout <<"\n";
             cout <<"\n";
             cout<<" DEPOSIT "<<setw(25)<<" WITHDRAWL "<<setw(25)<<" BALANCE "<<endl;
             cout<<"***********************************************************"<<endl;
             for (int j=0;j<d;j++)
             {
                 cout<<setw(5)<<dep[j]<<setw(50)<<bal[j]<<setw(5)<<endl;
             }
             for (int i=0;i<c;i++)
             {
                 cout<<setw(30)<<wid[i]<<setw(25)<<bal[d+i]<<setw(5)<<endl;
             }
             cout<<"***********************************************************"<<endl;
             cout<<"Do you want a copy of the check book balance sheet on file? (Y/N)";
             cin>>z;


             //getline(cin, z);
             //cin.ignore(1,' ');
             if (z=="Y" || z=="y")
             {
                 FILE *stream ;
                 if((stream = freopen("output.txt", "w", stdout)) == NULL)
                    exit(-1);
                 cout<<"***********************************************************"<<endl;
                 cout<<"******* C H E C K B O O K  B A L A N C E S H E E T ********"<<endl;
                 cout<<"***********************************************************"<<endl;
                 cout <<"\n";
                 cout <<"\n";
                 cout<<" DEPOSIT "<<setw(25)<<" WITHDRAWL "<<setw(25)<<" BALANCE "<<endl;
                 cout<<"***********************************************************"<<endl;
                 for (int j=0;j<d;j++)
                 {
                     cout<<setw(5)<<dep[j]<<setw(50)<<bal[j]<<setw(5)<<endl;
                 }
                 for (int l=0;l<c;l++)
                 {
                     cout<<setw(30)<<wid[l]<<setw(25)<<bal[d+l]<<setw(5)<<endl;
                 }
                 cout<<"***********************************************************"<<endl;
                 fclose (stream);

                 //return 0;

                 stream = freopen("CON", "w", stdout);

             }  
          }
          if (a==1)
          {
             //cout <<"\n";          
             cout<<"Cash Deposit : ";
             cin>>dep[d];
             cout <<"\n";
             bl=bl+dep[d];
             bal[d+c]=bl-lwid;
             d++;
             goto abc;
          }
          else if (a==2)
          {
             amt=0;
             lwid=0;
             //cout <<"\n";          
             cout<<"Cash Withdwarl : ";
             cin>>wid[c];
             for (int k=0;k<d;k++)
             {
                 amt=amt+dep[k];
             }
             for (int l=0;l<c+1;l++)
             {
                 lwid=lwid+wid[l];
             }
             //cout <<"\n amt ="<<amt<<" lwid ="<<lwid<<endl;;
             amt=amt-lwid;
             bal[d+c]=amt;
             c++;


             goto abc;
          }

          cout <<"\n" << " Do you wants to run this program again? (Y/N):";
          cin>>Continue;
          //cin.ignore(1,' ');
          //getline(cin, Continue);
      }
      while (Continue=="Y" || Continue=="y"); 
      if (Continue=="N" || Continue=="n")
      {
         //cin.clear();
         return 0;
      }
}
bool Mile()
{
     //cout.setf(ios_base::fixed, ios_base::floatfield);
     //cout.precision(2);
     string Cont;
      do
      {
      system("cls");
      float hval,istval,isp,ival,nm;
      isp=0.00;
      int a=1;

      float isTotval=0.00;
      cout<<"****************************************************************"<<endl;
      cout<<"*            T R I P  M I L E A G E  R E P O R T               *"<<endl;
      cout<<"****************************************************************"<<endl;
      cout <<"\n"; 
      cout <<" This program will create a spreadsheet detailing the number of "<<endl;
      cout <<" trips and totaling the total mileage owed to the traveler."<<endl;
      cout <<"\n";  
      cout<<"Enter the number of Trips : ";
      cin>>hval;
      int vl[100];
      int nam[100];
      float cen[100];
      for (int i=0;i<hval;i++)
      {

          cout <<"\n";
          cout <<"\n";
          cout<<"Enter in the trip number  : ";
          cin>>nm;
          nam[a]=nm;

          cout<<"Enter in the miles for the trip : ";
          cin>>ival;
          vl[a]=ival;

          cout <<"Enter in the miles amount <Enter .50 for 50 cents> :";
          cin>>istval;
          cen[a]=istval;
          a=a+1;

      } 
      cout <<"\n";
      cout <<"\n";
      cout <<"\n";  
      a=1;
      cout <<" Trip"<<setw(15)<<"Miles"<<setw(17)<<"Cost/Mile"<<setw(15)<<"Expense"<< endl;
      cout<<"*****************************************************************"<<endl;
      for (int m=0;m<hval;m++)
      {
      ival=(cen[a]*vl[a]);
      isTotval=isTotval+ival;
      cout <<" "<<nam[a]<<setw(15)<< vl[a]<<setw(14)<<cen[a]<<setw(14)<<"$"<<(cen[a]*vl[a])<< endl;
        a=a+1;
      }
      cout <<setw(47)<<"$"<<isTotval;    
      cout<<"\n";
      cout<<"\n";
      cout <<"\n" << " Do you want tu prepare another mileage speadsheet? (Y/N) :";
      cin  >> Cont;

      }
      while (Cont=="Y" || Cont=="y"); 
      if (Cont=="N" || Cont=="n")
      {
         return 0;
      }
}
void thnk()
{
    system("cls");
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@          T H A N K  Y O U            @@@@" << endl;
    cout << "@@@@         C O M E  A G A I N           @@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
    cout << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl; 
    system("pause");
}

in the above coding, i m getting problem with the phone number in contact card and balance sheet problem also, which is option 2 and option 3...
if anyone can correct these errors, kindly show me the coding below in your comments..

Regards

Recommended Answers

All 20 Replies

... And the problem is?

you will have to tell us what the error(s) are, no one is going to wade through all that code to find out.

Also, have you installed Service Pack #5 or #6 for that compiler? Without it the compiler and some of it's header files are very buggy. You might be better off downloading the free Visual Studio 2012 Express.

delete line 4 -- it's the same file as line 5.

delete line 13 -- line 12 is sufficient.

first the problem is in contact name card, that the phone number is not coming in output.
second thre is decimal problem in sales tax..
third there is some allignment problem ...

yes, but where in the program do the problems appear? tell us a line number or even a function name.

what have you attempted to fix the problems? I know the compiler has an excellent debugger, have you used it to single-step though the function(s) in order to find out what is causing the problems?

also getting garbage problem after continueing the check balance part...

contact card error in line number 250 to 315
blancesheet problem in line number 350 to 452

check line 265 -- all that is getting is one character, not the complete string.

line 288: why are you calling strlen() to do something that std::string.length() already gives you?

commented: thank you +1

This may help, I've compiled with maximum warning levels, using Clang compiler, I get the following warnings:

sales_receipt_prog.cpp:238:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
sales_receipt_prog.cpp:314:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
sales_receipt_prog.cpp:263:15: warning: variable 'last' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
          if (s>0)
              ^~~
sales_receipt_prog.cpp:297:50: note: uninitialized use occurs here
          cout<<"*******"<<setw(23)<<first<<" "<<last<<setw(26-len5)<<"********"<<endl;
                                                 ^~~~
sales_receipt_prog.cpp:263:11: note: remove the 'if' if its condition is always true
          if (s>0)
          ^~~~~~~~
sales_receipt_prog.cpp:247:26: note: initialize the variable 'last' to silence this warning
          char first,last;
                         ^
                          = '\0'
sales_receipt_prog.cpp:453:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
sales_receipt_prog.cpp:523:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
5 warnings generated.

Addressing those warnings will be a good start to solving the problems (it probably will).

commented: always grateful to you +1

Here are some errors from VS 2012

c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(483): warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(487): warning C4244: '=' : conversion from 'float' to 'int', possible loss of data
1> Generating Code...
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(34): error C4700: uninitialized local variable 'selection' used
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(311): warning C4715: 'Cus' : not all control paths return a value
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(235): warning C4715: 'SaleR' : not all control paths return a value
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(450): warning C4715: 'Check' : not all control paths return a value
1>c:\dvlp\consoleapplication2\consoleapplication2\consoleapplication2.cpp(520): warning C4715: 'Mile' : not all control paths return a value

thank you guys it seems like it is started working without having any problems, there is just a bit problem with the card contact, in which the it ask for full name then i enter and again enter, so it is showing me a gap in output.. between name and address...

why are you pressing Enter key twice?

coz at the first enter it don't show the other option to submit the info.. i press the enter twice to get to the other option.

To be on the safe side, you should add cin.ignore(); after each input from cin.

commented: thank you +0

Please if anyone can try this program and check the error and problems, let me know... im totally stuck with them all.. all i have to do is to; get somet outputs like;

I. Application overview
You are going to create an application that will run 4 different programs. This program will be driven by a menu screen. The user will be able to choose which program to enter using the menu screen. Also, the user will only be able to exit using the menu screen.
II. Application Components
A. Welcome Screen
Most applications welcome a user before the start of the application. You will create a welcome screen. The figures below are examples of welcome screens.
(Note: This is only an example. Your application should look different from the one below)
B. Menu
This application is driven by a menu. You also should have some sort of error checking.
Below is an example of the menu screen:
(Note: This is only an example. Your application should look different from the one below)
C. Calculate Sales Tax on Multiple Items
This component will calculate the sales tax on multiple items.
Needed:
1. Introduction screen
2. The user will enter the number of items
3. The user will enter the name of the items
4. The user will have the ability of entering in the sales tax rate
5. The sales receipt will display the name and price of each item
6. It will display to the user the total sales price before taxes
7. It will display to the user the total sales price after taxes
8. Ask the user to run the this component again
Below is an example of the menu screen:
(Note: This is only an example. Your application should look different from the one below)
D. Entering Customer's Address
This component will have the user enter in a customer’s address and output the customer’s address in form of a record.
Below is an example of the output for this component
(Note: This is only an example. Your application should look different from the one below)
Needed:
1. The user will be asked to enter-in the following information
a.
Full Name
b.
Street Address
c.
City
d.
State
e.
Zip code
f.
Phone number
2. Output the customer’s initials at the top
3. Output the customer’s name
4. Output the customer’s address information
5. Phone number
6. Ask the user to run the this component again
E. Balance Check Book
In this component, you will create a program that will balance the user’s checkbook. The user will enter the necessary information needed to balance a checkbook.
Needed:
1. The user will be asked to enter-in the necessary information to balance a checkbook. (e.g. beginning balance, etc)
2. Print a balance sheet report to the screen. (Below is an example of the report)
3. Print a copy of the balance sheet report to a file
4. Ask the user to run the this component again
Below is an example of the output for this component
(Note: This is only an example. Your application should look different from the one below)
F. Trip Mileage Report
This program will create a spreadsheet detailing the number of trips and totaling the total mileage owed to the traveler. The user of the program will be asked to enter the following information:
1. The number of trips (As seen in the figure below)
2. The trip number
3. Miles of the trip
4. Cost per mile the organization will reimburse you for your travels
5. Ask the user to run the this component again
Below is an example of the output for this component
(Note: This is only an example. Your application should look different from the one below)
G. Error Checking
Your application will need to have an error checking component. If the user types in an invalid entry, they will need to be notified of this and ask to re-enter the Main Menu.
H. Thank You Screen
Your application is required to have a screen thanking the user for using your application

You didn't answer my original question -- have you installed Service Pack #5 or #6 for VC++ 6.0? There's no point in us trying to find your problem(s) if you haven't because the original compiler contains bugs in the file i/o header files. One of the bugs was that you had to press Enter twice for cin.

If you have not installed it, you need to download it from here and install it.

commented: thank you .. this is something i found out.. +0

I have installed service pack 5, and yes its some bug problem, now tell me how to resolve it...

I thought service pack 5 fixed that, but if not here is a link to doc file that explains how to correct it. You will need either Microsoft Office (Word) or OpenOffice in order to read it.

I have fixed my header file for vc, and every other necessary stuff... just getting one problem with "invalid reply"
there is an option in the program, if user put some invalid character either numeric or alpha, it will display an error which is called invalid reply, and it will give an option for re-enter the amount or name etc etc.. or no ...
but it just quit the whole program and exit the window...
how can i fix this error.

 // user input
      cout <<"\n" << " Do you wants to run this program again? (Y/N):";
      cin  >> Cont;

      if (cin.fail()) // error checking component 
      {
            cin.clear(); //This corrects the stream.
            cin.ignore(); //This skips the left over stream data.
            int as =err();
      }

      }
      while (Cont=="Y" || Cont=="y"); 
      if (Cont=="N" || Cont=="n")
      {
         return 0;
      }
}
// Error Checking
bool err()
{
    system("cls");
    char cn;
    cout << "               ==============================" << endl;
    cout << "               |         I N V A L I D      |" << endl;
    cout << "               |          R E P L Y       |" << endl;
    cout << "               =============================="<< endl;

    // usre input
    cout<<"Would you like to re-enter the main menu? (Y/N):";
    cin>> cn;
    if (cn=='Y' || cn=='y')
    {
        return 0;

    }
    else
    {
        exit (EXIT_FAILURE);
    }
}
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.