unbeatable0 32 Junior Poster in Training

Look at the code here:

if (pos != -1)
{
	goto badsearch;
}

I think you meant:

if (pos == -1)
{
	goto badsearch;
}

Another thing is that string::search() returns string::npos if the search function does not find what it was told to find, and not -1, so the code should be:

if (pos == string::npos)
{
	goto badsearch;
}
cout << search;
pos = search.find("=");
if (pos != string::npos)
{
	cout << "\n" << pos;
}

And one last thing: you can avoid using goto in your 'if' statement by replacing it with the statement continue; - this will jump to the beginning of the while loop:

if (pos == string::npos)
{
	continue;
}
siddhant3s commented: Neat +4
unbeatable0 32 Junior Poster in Training

Hi all,
what is the bug in the following code:

#include <iostream> 
#include <string>
int main()
{
string str = "Hello World!"
cout << str << endl;
cout << float x = 5.0f * str << endl;
int 65Num = 65;
cout << "65Num = " << 65Num << endl;
}

There are a lot of "bugs" in your code.
Frist, you miss the using namespace std; line before the main() function, so the compiler might not recognize cout and string .
You also missed a semicolon after "Hello World!" .
Another thing is that you can't declare variables inside cout , so you should take float x = 5.0f * str outside cout . The multiplication operation of a float type and string type is not even declared, so float x = 5.0f * str has no meaning. The variable 65Num has an "illegal" name - variables' names cannot begin with a digit.

tux4life commented: Nice explanation ! :) +1
unbeatable0 32 Junior Poster in Training

We won't do your homework. You should provide us some code so we can know you've at least tried.
http://www.daniweb.com/forums/announcement8-2.html

Salem commented: Well said +25
unbeatable0 32 Junior Poster in Training
#include<iostream>
#include<string>

using namespace std;

#define IS_STRING 1
#define IS_CHARACTER 2
#define IS_INTEGER 3
#define IS_FLOAT 4

int main(void)
{
string Input;
cout<<"Input a string/character/number:\n";
cin>>Input;
short int input_type=0;
int x;
bool DotReached=false;
if(Input.length()==1 && (Input[0]>'9' || Input[0]<'0'))
input_type=IS_CHARACTER;
else
  for(x=0;x<Input.length();x++)
  {
  if((Input[x]>'9' || Input[x]<'0') && Input[x]!='.') 
     {input_type=IS_STRING; break;}
   else if(Input[x]=='.')
     {if(!DotReached) DotReached=ture; else
        {input_type=IS_STRING; break;}
     }
  }
// continue from here
}
ninja_gs commented: Good , wat i needed is Got exactly ........ +1
unbeatable0 32 Junior Poster in Training
private:

double rad[b]ui[/b]s;

I think you swapped these two letters

ddanbe commented: great observation! +1