turbo-c++

How to read numbers on text files using turbo c++ 4.0?

无人久伴 提交于 2019-12-25 18:36:42
问题 I am a beginner in programming and I am trying to make a code that reads 2 numbers from a file and then displays it in the output window on turbo c++. My code only reads the first number and produces incorrect output for the second number. #include<iostream.h> #include<fstream.h> #include<conio.h> void main() { int x, y; clrscr(); ifstream inFile; ofstream outFile; inFile.open("prac.txt"); while(!inFile.eof()) inFile >> x >> y; cout << x << " " << y; inFile.close(); } 回答1: #include<iostream.h

long integer problem

混江龙づ霸主 提交于 2019-12-25 09:28:20
问题 I'm a beginner at C, and using Turbo C++ compiler (16 bit). In the software I'm writing, the maximum answer is around 32000. If I want a number larger than that, I use long int . If I execute the following program: #include <stdio.h> void main() { long int x; x=40000; printf("%d", x); } Then I get an error that the constant value is long in function main() . How can I get an answer more that 32000 and get rid of this error? also nw i change %d to %ld and use 40000L bt when i use unsigned

Grouping up students records in a Binary File in C++ Based on their Batch Number?

倾然丶 夕夏残阳落幕 提交于 2019-12-24 21:42:00
问题 im working on a console application in C++ (I'm a beginner) and the purpose is to make a small application that can store, read and modify students records Now, i want to group up data of binary file (class9.dat) such that all the students with common batch id ( char type batch[5] ) should stuck together , by saying "stuck together", i mean if initially, consider binary file consider data in this form [Tom , 2] [Harry, 1] [Peter, 2] [Stephen, 1] [Henry , 0] then, after stucking data together

how to create a project in turbo c++ 16 bit compiler

坚强是说给别人听的谎言 提交于 2019-12-23 10:52:51
问题 I want to create a project file turbo c++ and link the files in this project. Although i have tried for it but i found only one option that to open a project no option to create a new project. So How to do that. 回答1: Basically, what you want to do, is to "Open Project". There, you type in a projects name. It must end with ".PRJ" . When you open it, it will be created. Then you can add files to the project by pressing "Insert". But have a look at the links below. In case these links disappear

Is there any way to obtain antique versions of Borland's Turbo C++ compiler for free?

余生长醉 提交于 2019-12-23 07:00:11
问题 I am looking for an old version of the Borland Turbo C++ compiler. However I have to get it in legal way. Has anyone heard something about discounts for such old compilers? [EDIT] I would like to publicize my old sources for educational purposes, however they will only compile on this old compiler. I want to show my blog readers what mistakes they should try to avoid while learning a new language. So It would be great if anyone could download the sources and compile them on their own computer

Turbo C++ system function running an executable

大兔子大兔子 提交于 2019-12-23 06:29:12
问题 How to run any exe file from turbo c++? I know that I should stop using turbo c++ and move one to Dev or Code::Blocks, but my school doesn't agree so I gotta wing it. I just want to know how to run a file with or without the system() function. Any kind of advice is welcome Here's what I have tried so far: 1 #include<process.h> int main() { system("tnfsv13.exe"); //tnfsv being a 16-bit application(The need for slowness v 13) return 0; } 2 #include<process.h> int main() { system("tnfsv13.bat");

C program gives an output different on different compiler [duplicate]

荒凉一梦 提交于 2019-12-13 19:43:01
问题 This question already has answers here : Why are these constructs using pre and post-increment undefined behavior? (14 answers) Closed 5 years ago . I ran a C program and got different output on different C compilers. Below is my program void main() { int i=5; printf("%d%d%d%d%d",i++,i--,++i,--i,i); } ON boarnland c++ complier o/p is 45545 and on gcc its 45555 is it really compiler dependent or its OS dependent? The arguments in a function call are pushed into the stack from left to right.

How do I do graphics easily in a modern linux? [closed]

你离开我真会死。 提交于 2019-12-13 09:48:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Here is an example of the sort of C program one could write in the old days: #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> void main() { int gd=DETECT, gm; initgraph(&gd, &gm, "c:\\turboc\\bgi"); circle(200,100,150); getch(); closegraph(); } I

C++ Code displays different, which is unexpected, output in different compilers

佐手、 提交于 2019-12-11 11:59:47
问题 This is a beginners question. Following is the C++ code that I was working with int main() { int x=5, y=5; cout<<x--; cout<<","; cout<<--x; cout<<","; cout<<y--<<","<<--y; return 0; } When run in Turbo C++ 3.0 the following is the output displayed by the code: 5,3,4,4 When compiled with Code::Blocks on Windows (uses MinGW with GCC/G++) the following is the output displayed: 5,3,4,3 Previously, I have heard that sometimes different compilers behave differently to certain problems, but I don't

Compiling Multi-File Project in Turbo C++

对着背影说爱祢 提交于 2019-12-11 11:41:13
问题 I have written a project for a friend in Visual Studio, containing bunch of .h and .cpp files. Now I want to compile my code in Turbo C++ and when I compile the main function the following error occurs: unable to open include file 'blah.h' How can I compile my multi-file project in Turbo C++? I haven't written a line in Turbo C++ in my life! So any help would be appreciated. 回答1: From the menubar , select the Project menu, then New Project . The name you give the project in 'Project Path and