I use Turbo C++ compiler to compile Cpp program.
when i use it . shows error( undef :"cout " "endl") but included CONIO.h . Also I checked OPTIONS-> DIR - where I have TC Folder(My case I have it in E:\TC\INCLUDE & E:\TC\LIB) Even The Example Programs is Not Running . It Doesn't Recosing the Header files .

Please Help me .
Please Send Me some Guide lines .

Dani AI

Generated

Quick diagnosis and practical next steps. The compiler errors about missing C++ names and a missing header mean the toolchain on that PC isn’t locating the C++ standard headers (or the build is running in a mode that doesn’t use them). Verify the actual include folder on disk contains the C++ headers, confirm the IDE’s include/lib paths point to that same folder, and make sure the source is compiled as C++ (file saved with a .cpp extension and the project/compiler set to C++). If headers are absent or corrupted, reinstall the compiler or use a more up-to-date toolchain.

Parsing user input by reading text first is the right approach. As suggested, accept each input as text and decide its type with a small parser instead of trying to scanf/stream into int/float/char directly. and rightly flagged header issues earlier; once the headers/build mode are fixed, use a short validation routine to detect integer vs floating input (allow optional sign, at most one dot, and at least one digit), then convert and compare numerically. If values aren’t numeric, handle single characters or compare strings as a fallback.

Example parser + compare (illustrates the approach; adapt for the target compiler):

#include <iostream>
#include <string>
#include <cctype>

bool isInteger(const std::string &s) {
  if (s.empty()) return false;
  size_t i = (s[0]=='+'||s[0]=='-') ? 1 : 0;
  if (i==s.size()) return false;
  for (; i<s.size(); ++i) if (!std::isdigit((unsigned char)s[i])) return false;
  return true;
}

bool isFloat(const std::string &s) {
  if (s.empty()) return false;
  size_t i = (s[0]=='+'||s[0]=='-') ? 1 : 0;
  bool seenDot = false, hasDigit = false;
  for (; i<s.size(); ++i) {
    if (s[i]=='.') { if (seenDot) return false; seenDot = true; continue; }
    if (!std::isdigit((unsigned char)s[i])) return false;
    hasDigit = true;
  }
  return hasDigit && seenDot;
}

Final notes: use int main() returning 0, avoid depending on non-standard headers if portability is needed, and consider using a modern free compiler (MinGW/GCC, clang or an online compiler) if the installed Turbo C++ is missing standard files or behaves oddly.

Recommended Answers

All 17 Replies

Member Avatar for Member #46692

Have you inluded iostream.h ?

Yes Sir I did.

It was Just a Basic Program to Find Greates Three No ;
Here is :
#include<stdio.h>
#include<conio.h>
int main()
{
int a[3];
int s=3;
int i,j,temp;
for(i=0;i<s;i++)
cout<<a<<" ";
cout<<endl;
for(i=0;i<s;i++)
/*
int idx;
char str[STRINGLENGTH];
int numbersfound = 0;
int dotsfound = 0;
for (idx=0; (idx<STRINGLENGTH) && (str[idx]); idx++){
numbersfound += ((str[idx] >= '0') && (str[idx] <= '9'));
dotsfound += (str[idx] == '.');
}
if (numbersfound == STRINGLENGTH)
printf("integer");
else if ((dotsfound == 1) && (numbersfound == STRINGLENGTH-1))
printf("floating point");
else
printf("string");

*/
for(j=0;j<(s-i);j++)
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}

for(i=0;i<s;i++)
cout<<a<<" ";
cout<<endl;
getchar();
return 1;
}

Sir while I Compile it shows this error :

e:\psgitd~1\finals~1\greatest.cpp:9: `cout' undeclared (first use this function)
e:\psgitd~1\finals~1\greatest.cpp:9: (Each undeclared identifier is reported only once
e:\psgitd~1\finals~1\greatest.cpp:9: for each function it appears in.)
e:\psgitd~1\finals~1\greatest.cpp:10: `endl' undeclared (first use this function)

Member Avatar for Member #46692

Sir I do not see the iostream.h in the code shown above.

oh sorry . now when i include it :
error :
1 e:\psgitd~1\finals~1\greatest.cpp
iostream.h: No such file or directory

Member Avatar for Member #46692

Post all your new code please

K thanks 4 ur Kind Help
I was Just a beginer
And I will DO it Carefuly

Sir My Goal
is to Get 3 inputs from user
and Find the Greatest of all
and list out it
but matter of fact the Big deal is
the INPUT may be int or may be float or char
1st i need figurout the ds of input and the find greatest .

This is my point,
Any Suggestion Sir

Okay ,

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3];
int s=3;
int i,j,temp;
for(i=0;i<s;i++)
cout<<a[i]<<" ";
cout<<endl;
for(i=0;i<s;i++)
/*
int idx;
char str[STRINGLENGTH];
int numbersfound = 0;
int dotsfound = 0;
for (idx=0; (idx<STRINGLENGTH) && (str[idx]); idx++){
  numbersfound += ((str[idx] >= '0') && (str[idx] <= '9'));
  dotsfound += (str[idx] == '.');
}
if (numbersfound == STRINGLENGTH)
  printf("integer");
else if ((dotsfound == 1) && (numbersfound == STRINGLENGTH-1))
  printf("floating point");
else
  printf("string");

*/
for(j=0;j<(s-i);j++)
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}

for(i=0;i<s;i++)
cout<<a[i]<<" ";
cout<<endl;
getchar();
return 1;
}

Sir My Goal
is to Get 3 inputs from user
and Find the Greatest of all
and list out it
but matter of fact the Big deal is
the INPUT may be int or may be float or char
1st i need figurout the ds of input and the find greatest .

This is my point,
Any Suggestion Sir

Member Avatar for Member #46692

Sir I don't think you need to sort the input from lowest to biggest.

That is a clue.

okay i got it
but how to find the User Input is flaoting or char or int
how to chek ??

Member Avatar for Member #46692

The way I see it is to accept input as a char array.

And write a parser to decipher one from the other.

For example?

Unless there is an easier c++ command, I don't know, and it is hardly going to work with the antiquated version of turbo c you probably have? But then I don't know what version of turbo c you have...

Thanks ;-)

1 e:\psgitd~1\finals~1\greatest.cpp
iostream.h: No such file or directory

Because it's #include <iostream> no ".h".

Hi guys Can you explain the code
int idx;

char str[STRINGLENGTH];
int numbersfound = 0;
int dotsfound = 0;
for (idx=0; (idx<STRINGLENGTH) && (str[idx]); idx++){
  numbersfound += ((str[idx] >= '0') && (str[idx] <= '9'));
  dotsfound += (str[idx] == '.');
}
if (numbersfound == STRINGLENGTH)
  printf("integer");
else if ((dotsfound == 1) && (numbersfound == STRINGLENGTH-1))
  printf("floating point");
else 
  printf("string");

please............

The header file you want is <iostream>, not <iostream.h>

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.