Hi all,

I have a little question, my compiler is giving me the following error:

error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
see declaration of 'std::operator <<'

Here is the main part of my project.

#include <iostream>
#include <String>
#include <fstream>
#include "BTree.h"
using namespace std;

int Check(double Z);								//First Number Selected


int main()
{

	cout << "\tWelcome to Binary Tree Sorting Program" << endl;
	cout << "\nInput integers will be sorted." << endl;
	

	char symbol;
	BTree T;										//establish BTree class
	int Input;										//variable Insert

	while(true)
	{
		cout << "\nPress I to input integers" << endl;
		cout << "\nPress D to display the list" << endl;
		cout << "\nPress E to exit the program" << endl;
		cout << "-> ";
		cin << symbol;
		cout << endl;

	
	switch(symbol)
	{
	case 'I':
	case 'i':
		for(int i=0;;i++)
		{												//loop until break called
			cout << "Insert number (Q to quit)";		//user interface
			cin >> Input;								//user input

			if(Input == -1)								//declare if break
				exit(0);								//break the loop
			if(Check(i))								//check if 1st input
				T.FInsert(Input);						//call FInsert
			else										//otherwise:
				T.Put(Input);							//call normal Put
		}
		break;

	case 'D':
	case 'd':
			cout << "Displaying the list" << endl;
			cout << endl;
			T.Put(Input);
			break;
			
	case 'E':
	case 'e':
		if(symbol == 'e' || symbol == 'E')					//If the user press E or e, program terminates
				exit(0);
	}
	}
	return 0;
}


int Check(double Z)
{
	if(Z==0)
		return 1;
	else
		return 0;
};

THanks for the help

Recommended Answers

All 5 Replies

which line was the error on ?

On this one:

cin << symbol;

you should have used cout not cin. Or if your intent is to get keyboard input then use the >> operator, not <<.

wow, completely blind right now thats probably why i didnt get it haha
thanks

I've done that too. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.