I was wondering what Im doin wrong with this code, I keep getting errors like, "error C2297: '>>' : illegal, right operand has type 'float' ".
Im a beginner.Code:// Ebay Business organizer.cpp : Defines the entry point for the console application. // #include <fstream> // header files #include "stdafx.h" #include <iostream> using namespace std; //start of functions void addrecord(); void findtotal(); //globals float temp_data; float multa; float multb; int main() { int input; start: cout<<" Welcome to the ebay business or seller's organizer! " <<endl; cout<<"---------------------------------------------------------------------------"<<endl; cout<<"1. Add a new record; the item number, quanity, price, to the database. "<<endl; cin>> input; switch ( input ) { case 1: addrecord(); } cin.get(); return 0; } void addrecord() { ofstream add_record ( "db.txt", ios::app ); cout<<"---------------------------------------------------------------------------"<<endl; cout<<"Enter the item number:"<<endl; cin>>temp_data; cout<<"Processing data..."<<endl; temp_data>>add_record; cout<<"Enter item quanity:"<<endl; cin>>temp_data; temp_data>>multa; cout<<"Processing data..."<<endl; temp_data>>add_record; cout<<"Enter item price:"<<endl; cin>>temp_data; temp_data>>multb; cout<<"Processing data..."<<endl; temp_data>>add_record; cout<<"Enter item name:"<<endl; cin>>temp_data; cout<<"Processing data..."<<endl; temp_data>>add_record; temp_data = multa * multb; temp_data>>add_record; cin.ignore(); cout<<"Item added to db."<<endl; goto start; }



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.