turbo-c++

adding timer to game

我与影子孤独终老i 提交于 2019-12-11 08:35:23
问题 I am making a game program in turbo c++ for my project and I need help on how to add a game timer, I've seen videos on how to create timer using while loop but I don't know how to implement it to my game. My plan for my game is to have it show 6 initialized letters(ex. "N A E B T S") and within 30 secs input as many words as possible which has corresponding points(6=10pts, 5=8pts, 4=6pts, 3=4pts). The correct words are written in a txt file with their corresponding points. Also the whole

Visual c++ to turbo c++

左心房为你撑大大i 提交于 2019-12-11 02:18:19
问题 Hi I have written a program in visual c++ and for whatever reason now i need to run/compile this same program in turbo c++ 3.0. I have managed to get the compiler from some source but I get a lot of errors when i try to compile my code. I have commented out "#include stdafx.h" set the appropriate paths for the directories and libraries in the ide. these are the lines that give me errors #include <list> //Error unable to open include file list using namespace std; //Declaration syntax error

Passing array to function with dynamic declaration of array in C/C++

☆樱花仙子☆ 提交于 2019-12-08 09:56:44
问题 I want to pass array to function in C/C++ without declaring and assigning it previously. As in C# we can: fun(new int[] {1, 1}); //this is a function call for void fun(int[]) type function I am not very sure about the correctness of the above code. But I had done something like this in C#. How can we pass array to function using dynamic declaration (on the spot declaration)?? I'd tried it using following way. But no luck fun(int {1,1}); fun(int[] {1,1}); fun((int[]) {1,1}); can't we do so..??

Decompression stops inbetween and output file filled with zeros(BLACK PIXELS)?

我是研究僧i 提交于 2019-12-05 02:56:57
问题 I am trying to apply DCT(discrete cosine transformation) compression on a bmp(bitmap) file. I have a c file which i am running in Turbo C++. This is not actually compressing but i was trying to implement the DCT and IDCT. The code is as follows: /* the image to be compressed is a bmp with 24 bpp and with name "college4.bmp" of dimensions 200*160 ie 25*20- 8*8 blocks o/p is college2.dat format: 8 bit signed integers starting rowwise from 0,0 to 8,8 the coefficients order is blue,green,red for

How to make the last letter blink?

别来无恙 提交于 2019-12-04 07:02:04
问题 I'd recently created this program that displays the last letter of a string. Using this code: #include<conio.h> #include<string.h> #include<stdio.h> void main() { clrscr(); char text[255]; int length= strlen(text); char lastchar=text[length-1]; gets(text); cout<<lastchar; getch(); } If I use textattribute or textcolor+128 and change cout to cprintf(lastchar) I receive an error which says: cannot convert int to const* char" and "type mismatch in parameter '___format' in call to 'cprintf(const

How to read data from files in Turbo c++ 4.0?

血红的双手。 提交于 2019-12-02 23:31:46
问题 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(); } The file contains the

How to read data from files in Turbo c++ 4.0?

随声附和 提交于 2019-12-02 13:26:59
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(); } The file contains the numbers: 2 3 Output : 2 0 Output when called as a function: 2 -28903 which is very different if I call it

How to make the last letter blink?

回眸只為那壹抹淺笑 提交于 2019-12-02 12:51:51
I'd recently created this program that displays the last letter of a string. Using this code: #include<conio.h> #include<string.h> #include<stdio.h> void main() { clrscr(); char text[255]; int length= strlen(text); char lastchar=text[length-1]; gets(text); cout<<lastchar; getch(); } If I use textattribute or textcolor+128 and change cout to cprintf(lastchar) I receive an error which says: cannot convert int to const* char" and "type mismatch in parameter '___format' in call to 'cprintf(const char*,....)' This is what you are looking for: //------------------------------------------------------

adding timer to game

天涯浪子 提交于 2019-12-02 05:38:09
I am making a game program in turbo c++ for my project and I need help on how to add a game timer, I've seen videos on how to create timer using while loop but I don't know how to implement it to my game. My plan for my game is to have it show 6 initialized letters(ex. "N A E B T S") and within 30 secs input as many words as possible which has corresponding points(6=10pts, 5=8pts, 4=6pts, 3=4pts). The correct words are written in a txt file with their corresponding points. Also the whole thing is in loop with clrscr(); Here is some parts of the game code: void start() { char arr[10][50] = {" B

Borland x86 inlined assembler; get a label's address?

核能气质少年 提交于 2019-11-30 19:22:18
I am using Borland Turbo C++ with some inlined assembler code, so presumably Turbo Assembler (TASM) style assembly code. I wish to do the following: void foo::bar( void ) { __asm { mov eax, SomeLabel // ... } // ... SomeLabel: // ... } So the address of SomeLabel is placed into EAX. This doesn't work and the compiler complains of: Undefined symbol 'SomeLabel'. In Microsoft Assembler (MASM) the dollar symbol ($) serves as the current location counter, which would be useful for my purpose. But again this does not seem to work in Borlands Assember (expression syntax error). Update: To be a little