471,595 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,595 software developers and data experts.

No Operator Found - Need Help.

This is just one of the sources for a project that deals with a
library. I am having problems, here is the errors.

all these.. i belive it has something to do with it needs a subscript?
but i'm not exactly sure what to do..

(33): error C2679: binary '>>' : no operator found which takes a
right-hand operand of type 'char [20][10]' (or there is no acceptable
conversion)
37): error C2679: binary '>>' : no operator found which takes a
right-hand operand of type 'char [20][14]' (or there is no acceptable
conversion)
(42): error C2679: binary '>>' : no operator found which takes a
right-hand operand of type 'float [20]' (or there is no acceptable
conversion)
(35): error C2679: binary '>>' : no operator found which takes a
right-hand operand of type 'int [20]' (or there is no acceptable
conversion)

then this last error i get..

(40): error C2664: 'std::basic_istream<_Elem,_Traits>::_Myt
&std::basic_istream<_Elem,_Traits>::getline(_El em *,std::streamsize)' :
cannot convert parameter 1 from 'char [20][40]' to 'char *'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
Here is the code..

//cashier

#include <iostream>
#include <iomanip>
#include "cashier.h"

using namespace std;

int cashier()
{
//declare variables
// char date[10];
int quant = 0;
// char isbn[15];
// char title[40];
// float price = 0;
float tax = .06f;
char yesNo;

extern char isbn[20][14];
extern char bookTitle[20][40];
extern char dateAdded[20][10];
extern int qtyOnHand[20];
extern float retail[20];
do
{
system("cls");
cout << "Serendipity Booksellers\n";
cout << " Cashier Module\n\n";
cout << "Date: ";
cin >> dateAdded;
cout <<"\n" <<"Quantity of Book: ";
cin >> qtyOnHand;
cout << "\n" << "ISBN: ";
cin >> isbn;
cin.ignore();
cout << "\n" << "Title: ";
cin.getline(bookTitle, 40);
cout <<"\n" << "Price: ";
cin >> retail;
system("cls");

float total = quant * retail;
float ttax = tax*total;
float ftotal = ttax+total;

//final output
cout << "Serendipity Booksellers\n\n";
cout << "Date: " << dateAdded << "\n\n\n";

cout <<"Qty\tISBN\t\tTitle\t\t\t\tPrice\t\tTotal\n";

cout<<"___________________________________________ _____________________________________\n";
cout << qtyOnHand;
cout << "\t";
cout << isbn;
cout << "\t";
cout << bookTitle;
cout << "\t\t";
cout<< setprecision(2) << fixed;
cout << "$ " << retail;
cout << "\t\t";
cout << "$ " << total;
cout << "\n\n\n";
cout<<" \t \t\tSubtotal " << setw(41) << "$ " << total
<<"\n";
cout<<" \t \t\tTax " << setw(47)<< "$ " << ttax <<"\n";
cout<<" \t \t\tTotal " << setw(44) << "$ " << ftotal
<<"\n";
cout<<"\nThank You for Shopping at Sereendipity!\n\n";

cout <<"\n\tWould you like to make another purchase? (Y/N) ";
cin >> yesNo;
} while(yesNo == 'Y');


cout << "\n\n";
return 0;
}

any advise/suggestion would be great. thank you very much!

Nov 22 '05 #1
2 5273
well i got them errors figured out. they needed a subscript where to go
so i just made a for loop.. for (int index = 0; index < 20; index++)..
then i closed it right before the end while.

but i still have these errors.

(49): error C2297: '*' : illegal, right operand has type 'float [20]'
(42): error C2664: 'std::basic_istream<_Elem,_Traits>::_Myt
&std::basic_istream<_Elem,_Traits>::getline(_El em *,std::streamsize)' :
cannot convert parameter 1 from 'char [20][40]' to 'char *'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]

Nov 22 '05 #2
<mi**********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
well i got them errors figured out. they needed a subscript where to go
so i just made a for loop.. for (int index = 0; index < 20; index++)..
then i closed it right before the end while.

but i still have these errors.

(49): error C2297: '*' : illegal, right operand has type 'float [20]'
(42): error C2664: 'std::basic_istream<_Elem,_Traits>::_Myt
&std::basic_istream<_Elem,_Traits>::getline(_El em *,std::streamsize)' :
cannot convert parameter 1 from 'char [20][40]' to 'char *'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]


Look at my reply to Groll35, the message thread just above this one.
Apparently you are both doing the same homework problem and both had the
exact same problem.
Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by victor75040 | last post: by
10 posts views Thread by Piotr Wyderski | last post: by
reply views Thread by A. W. Dunstan | last post: by
20 posts views Thread by Patrick Guio | last post: by
8 posts views Thread by David Williams | last post: by
8 posts views Thread by john | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.