user1022883
user1022883

Reputation: 3

error C2784 in Visual 2010 C++

When i go to compile this code it gives me error C2784:

error C2784: 'std::basic_istream<_Elem,_Traits> &std::operator >>(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream'

1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string(458) : see declaration of 'std::operator >>'

what does that mean? did 2010 change some preproccessor directives? or am i just a noob?

i figure im not using getline correctly, but thats my guess any help would be appreciated. thank you

#include "stdafx.h"
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
using namespace System;

int main()
{
    string Date;
    string ISBN;
    string Title;
    int qty;
    float price;
    cout<< "\n\n Serendipity Booksellers\n Cashier Module\n\n";
    cout<< "Date:";
    getline(cin, Date);
    cout<< "\nQuantity of Book:";
    cin>> qty;
    cout<<"\nISBN:";
    getline(cin, ISBN);
    cout<<"\nTitle:";
    getline(cin, Title);
    cout>>"\nPrice:";
    cin>> price;

    cout<<"Serendipity Book Sellers\n\nDate:\n\nQty   ISBN\t\tTitle\t\t\tPrice\tTotal\n";
    cout<<"____________________________________________________________________________";
    cout<<"\n\n\n\t\tSubtotal\n\t\tTax\n\t\tTotal\n\n\nThank You for Shopping at Serendipity!\n";

    return 0;
}

Upvotes: 0

Views: 1298

Answers (1)

K-ballo
K-ballo

Reputation: 81349

cout>>"\nPrice:";

You are trying to "read" from cout.

Upvotes: 3

Related Questions