Errors in Program

I keep getting errors with this program in Visual Studios.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <cstdlib>
#include <iostream>
#include <iomanip>

using namespace std;

int main(int argc, char** argv) {

    int n = 0;
    float sum = 0.00;  
    float tax = 0.00; 
    float salesTax = 0.00; 
    char ch = 'y';
    float *itemsPrice; 
    string* itemsNames;  

    cout << "Welcome to the new and approved Sales Receipt system. \n";
    cout << "This new system will not only calculate multiple sales items.\n";
    cout << "It will also store the name of the sales item. \n";
    cout << "             Enjoy the new system !!!! \n\n\n";

    while (ch == 'Y' || ch == 'y') {
        sum = 0;
        cout << "\nEnter in the number of sales items to be calculated :";
        cin >> n; 
        cout << "\n\n\n";


        itemsPrice = new float[n]; 
        itemsNames = new string[n]; 

        for (int i = 0; i < n; i++) {
            
            cout << "Enter in the name of sales item number " << (i + 1) << " : ";
            cin >> itemsNames[i]; 
            cout << "Enter in the price of the " << itemsNames[i] << " : $ ";
            cin >> itemsPrice[i]; 
            
            sum = sum + itemsPrice[i]; 
        }

        cout << "\n\nEnter in the sales tax percentage\n";
        cout << "<Enter 10 for 10% >: ";
        cin >> tax; 

        salesTax = sum * tax / 100;

        cout << fixed; 
        cout << setprecision(2); 

        cout << "\n\n\n*******************************************************" << "\n";
        cout << "*******************************************************" << "\n";
        cout << "********** S A L E S  R E C E I P T *******************" << "\n";
        cout << "*******************************************************" << "\n";
        cout << "**                **              **                 **" << "\n";
        cout << "**  Item Names    **              **     Price       **" << "\n";
        cout << "*******************************************************" << "\n";
       
        for (int j = 0; j < n; j++) {
            cout << "**  " << left << setw(30) << itemsNames[j] << "$" << setw(12) << right << itemsPrice[j] << "      **" << "\n";
        }

        cout << "*******************************************************" << "\n";
        cout << "**  " << left  << setw(30) << "Sales Total         "<<"$" << setw(12) << right << sum << "      **" << "\n";
        cout << "**  " << left  << setw(30) << "Sales tax           "<<"$" << setw(12) << right << salesTax << "      **" << "\n";
        cout << "**  " << left  << setw(30) << "                                 ------------" << "    **" << "\n";
        cout << "**  " << left  << setw(30) << "Grand Total         "<<"$" << setw(12) << right << sum + salesTax << "      **" << "\n";
        cout << "**                                                   **" << "\n";
        cout << "*******************************************************" << "\n";
        cout << "*******************************************************" << "\n";
 
        cout << "\n\n\nDo you want to run this program again? <Y/N>: ";
        cin >> ch;
 
        while (ch != 'Y' && ch != 'y' && ch != 'N' && ch != 'n') {
            cout << "please enter a valid input\n\n";
            cout << "Do you want to run this program again? <Y/N>: ";
            cin >> ch;
        }
    }

    return 0;
}


These are the errors I get.

C:\Documents and Settings\ajc5212\My Documents\homework6.cpp(40) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or
there is no acceptable conversion)
C:\Documents and Settings\ajc5212\My Documents\homework6.cpp(41) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or
there is no acceptable conversion)
C:\Documents and Settings\ajc5212\My Documents\homework6.cpp(65) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or
there is no acceptable conversion)
Error executing cl.exe.

Any help would be appreciated.
You forgot to include <string>.
Topic archived. No new replies allowed.