I keep getting an error message when i try to run this program. It says he error is located at the cin >> fileName line in the load function. Any help would be great thanks:

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)

Arwork.h

#include <iostream>
#include <fstream>
#include <string.h>

using namespace std;
ifstream inData;
ofstream outData;
bool die = 1;
bool sorted = 0;

class Arwork
{
      public:
		     void Load();
             void Sort();
             void swap(int,int);
             float Average();
             float SmallestNum();
             float LargestNum();
             void Insertion();
             void Delete();
             int Search();
             float Between();
             void display_Array();
            
      private:
              float T[100];
              int size;
};

void Arwork ::Load()
{
      char answ;
      
      //prompts the user for keyboard of file input
      cout<< "Would you like to input from File or Keyboard" << endl;
      cout<< "Enter 'f' or 'k'" << endl;
      cin>> answ;
      
      //Keyborad input
      if(answ == 'k')
      {
            cout<< "Enter all the data at once or (Ctrl-Z to quit)" << endl;
            outData<< "Enter all the data at once or (Ctrl-Z to quit)" << endl;
            
            int i =0;
            while(cin)
            {  
            cin >> T[i];
            outData<< T[i]<< " ";
            if(cin) i++;
            size++;
            }
         size = size-1;
      }
      else
      {
          //file input
          string fileName;
           
           cin.clear();
           cout<< "Input file name, then press Ctrl-D, Enter" << endl;
           outData<< "Input file name, then press Ctrl-D, Enter" << endl;
           cin>>fileName;
           inData.open(fileName.c_str());   
                          
                    
          for (int i = 0; inData>> T[i]; i++)
              ++size;
          
       size = size-1;      
     }
}

//sorts the array
void Arwork ::Sort()
{

    
    int j, smallestAt;
	
    for (int i = 0 ; i < size - 1 ; i++)
	{
	    smallestAt = i;                 
	    for (j = i + 1 ; j < size ; j++)
	    {
		    if (T [j] < T[smallestAt])
		    { 
		      smallestAt = j;         
            } 
   	    } 
	    
	    //calls swap
        if (smallestAt != i)
	    { 
            swap (i, smallestAt);
	    } 
	 }
     sorted = 1; 
} 

//swaps the numbers in the array    
void Arwork ::swap (int loc1, int loc2)
{
    float temp = T [loc1];
    T [loc1] = T [loc2];
    T [loc2] = temp;
} 

//computes the average 
float Arwork :: Average()
{
      float total = 0.0;
      for(int k = 0;k< size;k++)
      {
              total += T[k];
      }
      
      cout<<total/size<<endl;
      outData<<total/size<<endl;     
      return total/size;
}

//finds the smallest number
float Arwork :: SmallestNum()
{
   float min = 0.0;
   for(int k = 0;k< size;k++)
   {
           if(T[k]<min)
           {
              min = T[k];
           }
   }
   cout<<min<<endl;
   outData<<min<<endl;
   return min;
}

//finds the largest integer
float Arwork ::LargestNum()
{
   float max = 0.0;
   for(int k = 0;k< size;k++)
   {
           if(T[k] > max)
           {
              max = T[k];
           }
   }
   cout<<max<<endl;
   outData<<max<<endl;
   return max;
}

//inserts a number in an array
void Arwork ::Insertion()
{
      float target = 0.0;
      cout<<"Enter the number you are inserting"<<endl;
      outData<<"Enter the number you are inserting"<<endl;
      cin>>target;
      
      int k=0;
      while((k< size) && (T[k] < target))
                k++;
      for(int index = size -1; index>=k;index --)
      {
                T[index + 1] = T[index];
      }
      
      T[k] = target;
      size = size + 1;
}

//deletes a number in an array
void Arwork ::Delete()
{
     float target = 0;
     cout<< "Enter the number you wish to delete" <<endl;
     outData<<"Enter the number you wish to delete" <<endl;
     cin>>target;
     
     int k=0;
     while((k<size) && (T[k] != target))
          k++;
     for(int index = k+1; index < size; index++)
          T[index -1] = T[index];
     
     size++;
}

//finds a number in an array
int Arwork ::Search()
{
     int num;
     if(sorted == true)
     {
       float target = 0;
       cout<< "Enter the number you wish to search for:" <<endl;
       outData<< "Enter the number you wish to search for:" <<endl;
       cin>>target;
            
       int k=0,h=0;
      for(h=0;h<size;h++)
      {
            
          if(T[h] == target)
            return h;
          }
      }
     else
     {
         cout<<"ARRAY NEEDS TO BE SORTED FIRST"<<endl;
         outData<<"ARRAY NEEDS TO BE SORTED FIRST"<<endl;
     }
   return 0;  
}
          
//counts how many values are between two numbers
float Arwork ::Between()
{
      int k = 0;
      int j = 0;
      float num1,num2;
      
      cout<< "Enter your First Number then press Enter" <<endl;
      outData<< "Enter your First Number then press Enter" <<endl;
      cin>> num1;
      
      cout<< "Enter your Second Number then press Enter" <<endl;
      outData<< "Enter your Second Number then press Enter" <<endl;
      cin>> num2;
      
      for(k=0;k > size;k++)
      {
         if((T[k]>num1)&&(T[k]<num2))
             cout<<T[k];
      }
      return j;
}

//displays the array
void Arwork ::display_Array()
{
     int k =0;
     for(k = 0;k<size;k++)
       cout<<T[k]<<" ";
     
     cout<< " "<<endl;
}
This article has been dead for over six months. Start a new discussion instead.