well when i try to run it, i get undefined symbols and unable to open include file conio.h...i thinks theres something wrong with the turbo c++ i downloaded but ive downloaded in every site it still the same and also when i run it in the shortcut icon it says "Invalid program file name, please check your pif file."
i cant use my turbo c++ and i want to learn
Did you compile the code? Wich compiler do you use? Where did you get the code from? Do you have any expierences with programming (do you know about compilers and library's etc.)?
If you're new, I would recommend to start with some tutorials, eg the one on this site, instead of downloading some random programs.
Btw. Next time post this sort of questions in the beginnersforum.
i didnt downloaded random programs, i downloaded turbo c++, and the program i used is the one that my teacher taught us in our homework its just a basic simple for statement, and yes i compiled it and the error is "Unable to open include file conio.h" and "Undefined symbol cin" im saying is i think there is something wrong with the turbo c++ that i downloaded but i downloaded in different sites and also got a copy from my school still same problem....and i tested one of the programs here i downloaded the "Binary Convert" program, the exe works fine but when i opened it with my c++ and run it the same errors appeared...
Post your code and make sure your include files are not ending in .h, should be <filename>. Also make sure you've included namespace std via a using statement.
this is the code i used, i downloaded this here in this site, and still the error says unable to open include file 'iostream' i think theres something missing in my turbo c++ or maybe something need to be fixed...since the code used is from here, therefore there is nothing with the code but the c++ in my pc...i need a good working turbo c++ i cant practice if i dont have a working one
#include <iostream>
using namespace std;
#include <cstring>
#include <cstdlib>
void prog()
{
entry = new char[501];
/* entry should be dynamic, otherwise a new
string entry of 501 chars would be created
each time function is called!
Talk about memory hog! */
cout<<"Enter string to convert (up to 500 chars): ";
cin.getline(entry, 500);
len = strlen(entry); /* get the number of characters in entry. */
/* this loop is executed for each letter in the string. */
for(int i = 0; i<len; i++)
{
total = 0;
letter = entry[i]; /* store the first letter */
ascii = letter; /* put that letter into an int, so we can
see its ASCII number */
while(ascii>0) /* This while loop converts the ASCII # into binary,
stores it backwards into the binary array. */
{
/* To get the binary code one must take the decimal number in
question, take it and divide it by two repeatedly, save
the remainder (which will become the binary number), save
the whole number, divide by two, and repeat the whole
process until 0 is reached. This if-else statement serves
this functionality, by getting the remainder of the ascii
code, storing it in the array and then dividing the int
ascii by two */
if((ascii%2)==0)
{
binary[total] = 0;
ascii = ascii/2;
total++; /* increasing by one each time will yeild the
number of numbers in the array. */
}
else
{
binary[total] = 1;
ascii = ascii/2;
total++;
}
}
total--; /* due to data type factors, the program will actually
add a 0 at the end of the array that is not supposed
to be there, decrementing total will solve this
problem, as that 0 will not be displayed. */
/* this while loop displays the binary code for that letter. */
while(total>=0)
{
cout<<binary[total];
total--;
}
}
delete[] entry; /* free up the memory used by entry */
cout<<endl<<"Do again(1 = yes, 2= no)?: ";
cin.getline(choice,3);
if(choice[0] == '1')
prog(); /* program is recursive, it calls itself. It's kinda
like a function loop of sorts. */
else
exit(0); /* quits the program */
}
oh yeah btw what do you mean if someone says "functions" in c++ ??? well my teacher got mad the other day and she gave a group to report about functions and after that we will have a quiz >.< oh god....
I'm not familiair with turbo c++. I don't know or the standard librarys comes with it. See or you can find a folder that's called "include" or someting like that. conio.h and all other librarys should be in there.
You may want to download another (free) compiler/IDE, eg dev-cpp or visual studios. For you, I think dev-cpp is the best: http://www.bloodshed.net/
oh yeah about that i see 3 download links which one should i get the 9MB , 2.4MB or 1.6MB.....and about the functions is that the only functions in c++?? about the OOP im learning that too....i think its fun when i get the hang of it
The orginal problem was that your sourcecode wont compile. So I guess you already downloaded the compiler itself. Can you post the link to the downloadpage, and tell me what exactly what you've done and what goes wrong?
and about the functions is that the only functions in c++??
I dont understand this question. Functions are a (principal) concept of c++. You can create your own functions. In fact, programming is all about creating your own functions. The tutorial I posted you gives a pretty good explanation about what fucntions are and what you can do with them. The don't tell everyting there is to know about functions, but that's alot.
Oke, I tought it was about turbo-c++. The upper one, of 9 mb. As you can read, the second one is without the default compiler (MinGw) and the tird is for delphi.
Okay, a couple of things:
1. Turbo C++ is a proprietary compiler and IDE (Integrated Development Environment) from Borland. There are other compilers and IDEs beside it, and it's of course incorrect to refer to any of them as "Turbo C++".
2. The compiler and IDE you downloaded in this case are MinGW (Minimalist GNU for Windows) -- a port or the popular GCC -- and Dev-C++ respectively.
3. conio.h is a non-standard header. As such, no other compiler (as far as I know) includes it (thankfully). Teachers who tell their students to use it should be punished with 100 lashes. Be sure to tell your teacher this.
If you're getting such messages as "unable to open include file ..." then you already have the compiler, otherwise, you'd get a different message from the IDE telling you it can't find g++.exe or something like that.
I'm guessing you somehow screwed up the installation by deleting files. Dev-C++ is old, but its installation procedure works perfectly, and its MinGW is also completely functional.
Well, I'll tell you why I don't think it should be used: non-standard headers bundled with compilers should be avoided like the plague if you intend to write something than compiles anywhere. I'm sure there are better reasons, though, such as being outdated, etc.
And if it is bad practise and non-standard, wy does MinGw include it?
Probably for the same reason that VC++ includes some Linux headers. I refuse to use those, too.