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! 2 5352
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>
]
<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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: victor75040 |
last post by:
Before you all start flaming me, I am not a student and this is not
for any homework. Just someone learing c++ on their own.
I am now up to the chapter in my book that describes operator...
|
by: Piotr Wyderski |
last post by:
Hello,
is it possible to reuse a friend operator which is defined
inside a class? I'd like to obtain the following behaviour:
class integer {
integer operator +(signed long int v) const...
|
by: A. W. Dunstan |
last post by:
I'm porting some code to Visual C++ and have run into a problem - the
compiler won't use a user-written cast operator.
The code uses an envelope-letter approach to passing (potentially)
large...
|
by: jstanforth |
last post by:
This is probably a very obvious question, but I'm not clear on what
operators need to be implemented for std::map.find() to work. For
example, I have a class MyString that wraps std::string, and...
|
by: Patrick Guio |
last post by:
Dear all,
I have some problem with insertion operator together with namespace.
I have a header file foo.h containing declaration of classes, typedefs and
insertion operators for the typedefs in...
| |
by: David Williams |
last post by:
Hi all,
I have a templated Vector3D class which holds (x,y,z) components as the
specified type. I quite often wish to cast a Vector3D holding ints into
a Vector3D holding floats and vice versa....
|
by: raylopez99 |
last post by:
I need an example of a managed overloaded assignment operator for a
reference class, so I can equate two classes A1 and A2, say called
ARefClass, in this manner: A1=A2;. For some strange reason...
|
by: john |
last post by:
Hey guys,
Quick question i have this code and what i want to do is create a deep
copy of class B. Now I tried doing this with the new operator and
pointers. Here's is the orignal
...
|
by: jerry.teshirogi |
last post by:
I have the following class and main:
//////////////////////////////////////////////////////////
#include <iostream.h>
class myVector
{
public:
double x, y, z:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |