Member Avatar

Hello, I am using turbo c++ 4.0. I know its outdated but i have to use turbo c++ for this project. Here is my current code, #include<iostream.h> #include <stdlib.h> #include <fstream.h> class item { private: char name[]; int code[]; float price[]; int z; fstream datfile; public: void add(void); void delete_(void); void sell_(void); void display_(void); void read_(void); void initial_(void); }; void item::initial_(void) { z = 0; datfile.open("data.dat",ios::in|ios::out); } void item::read_(void) { char line; //string databk[]; const int size = 100; char* dataArray = new char[size]; if(datfile.good()) { while(!datfile.eof()){ for(int i=0; i<size; i++){ datfile>>dataArray[i]; if(dataArray[i]=='\n'){ cout<<"\n"; } cout<<dataArray[i]; } } } else …

Member Avatar
0
51
Member Avatar

I used to have turbo c++ but it is outdated now, so the only problem i am having with that is that there was a great help documentation in turbo c++ for the language and i could just browse to any function of c++ and get its details. After turbo c i am not able to get that kind of help anywhere or in any compiler. Can anyone plz tell me where can get that kind of c++ help ?

Member Avatar
0
80
Member Avatar

Hello All Tell me who is correct I or my friend void main() { int GuessMe[4]={100, 50, 200, 20}; int Taker=random(2)+2; for(int Chance=0;Chance<Taker;Chance++) cout<<GuessMe[Chance]<<"#"; } I am testing random() in Turbo C++ 3.5 By this code I am always getting answer 100#50# whenever I am executing this code. My argument is random() always returning 0 from 0 & 1 so 0+2 is 2 but My friend challanged me with his logic int Taker = random(2) + 2; random(2) returns either 0 or 1 Hence, Taker is either (2+0=2) or (2+1=3) IF taker is 3, then as > for(int Chance=0; Chance<Taker; …

Member Avatar
0
53
Member Avatar

What I know is Linear Search and Sequential Search are same, if my knowledge is correct then kindly guide me wether the below algorithm work for linear search or not as it is a Sequential Search algorithm. > Step 1. Initialize searcharray, searchno, length. > Step 2. Initialize pos=0. > Step 3. Repeat step 4 till pos<=length. > Step 4. if searcharray[pos]=searchno > return pos > else > increment pos by 1. Secondly I need help on how can I move the found value at the first element of an array, I have this code which can find value which …

Member Avatar
0
13
Member Avatar

Hello Everybody I am successful in displaying Diagonal Array elements, but failed to display Non Diagonal array elements I tried a lot but unsuccessful. Here is the code what I am try with - #include<conio.h> #include<iostream.h> void accept(int a[4][4],int size) { cout<<"Diagonal One:"; for (int i=0;i<size;i++) for(int j=0;j<size;j++) if (i!=j) cout<<"\n"<<i <<" "<<j<<" "<<a[i][j]; } void main() { int a[4][4]={{5,4,3,4},{6,7,9,1},{8,0,3,7},{2,4,5,9}}; clrscr(); accept(a,4); getch(); } Example : if the array content is **5** 4 3 **4** 6 **7** **9** 1 8 **0** **3** 7 **2** 4 5 **9** Output through the function should be : 4 3 6 1 8 7 …

Member Avatar
0
18
Member Avatar

Hi all I am trying to remove consecutive blank space by single blank space but getting error by this small line- `ch='';` This is what I have done till now- #include <iostream.h> #include <ctype.h> #include <conio.h> void main() { char ch; int count=0; ifstream in_stream; ofstream out_stream; clrscr(); in_stream.open("A.txt"); out_stream.open("B.txt"); while (!in_stream.eof()) { if(isspace(ch)) count++; if(count >= 2) { ch=''; count = 0; } else { out_stream <<ch; } out_stream << ch; } } `Error is - Character constant must be one or two charcters long` I am learning C++ in Turbo C++ as per our syllabus requirement. Thank you …

Member Avatar
0
17
Member Avatar

Hello I have 4 problems to solve out of 4 I solved 3 but problem mention below is painfull, I am not able to find how I will interchange the '+' '-' operator. I need some code. I am using Turbo C++ Write a C++ function having two value parameters X and M with result type float to find sum of series given: 1-X+1/2!X2 – 1/3!X3+1/4!X4+…..+ 1/M!XM Thank you.

Member Avatar
0
49
Member Avatar

#include<conio.h> #include<stdio.h> #include<string.h> int mistakes_ctr=0; int x=52, y=22, i; void printM(){ gotoxy(20,20); cprintf("m"); } void printP(){ gotoxy(22,20); cprintf("p"); } void printL(){ gotoxy(24,20); cprintf("l"); gotoxy(34,20); cprintf("l"); } void printA(){ gotoxy(26,20); cprintf("a"); } void printN(){ gotoxy(28,20); cprintf("n"); } void printT(){ gotoxy(30,20); cprintf("t"); } void printO(){ gotoxy(32,20); cprintf("o"); gotoxy(36,20); cprintf("o"); } void printG(){ gotoxy(38,20); cprintf("g"); } void printE(){ gotoxy(42,20); cprintf("e"); } void game(){ do{ textcolor(GREEN); gotoxy(15,22); cprintf("Type the letter: "); scanf("%c", &letter); if(letter == 'm'){ printM(); } if(letter == 'p'){ printP(); } if(letter == 'l'){ printL(); } if(letter == 'a'){ printA(); } if(letter == 'n'){ printN(); } if(letter == 't'){ printT(); } if(letter …

Member Avatar
0
3
Member Avatar

Can mobile phones run c++ compilers such as borland and turbo? If yes pls do tell where i can download them thanks

Member Avatar
0
6
Member Avatar

im making a student marksheet generation project.....and i need a facility to print from turbo c++ to excel.... i have used only file handling and no database(tht was the criteria). pls help.....

Member Avatar
0
2
Member Avatar

I have tried searching internet a little bit and found some useful information about the command [CODE]SetLength[/CODE] I just wonder about a few things as I would like an array to "constantly" be redefined in size. When using it in one part of my program, it will be defined in one way. When using it in another part, it will be defined in another way. Ultimately, in my program, this may be done thousands of times. The reason why I want to use one variable for this is simply the enormous memory needed and lack of ability to make reuseable …

Member Avatar
0
6
Member Avatar

hi guys , what am i doing wrong here, i have instigated several approaches, in assembly 8086 using borland/turbo 7.0 pascal on win 98se (so i can communicate easily to parallel port and stipulation of assignment) my issue lies with being able to allow execution of a looped routine but keep a constant listen out for a keypress from the keyboard, at the point of the keypress the routine should jump to a call which then runs and returns back to the main routines loop. i have done as much as i can using interrupts but alas , even with …

Member Avatar
0
12
Member Avatar
Reusable Code Snippet password code

well am using the turbo c++ compiler , so you must convert it to cpp ( c++) before u can use it ok. here we go. steps: (1)press the windows shortcut key and hold R or go click on RUN (2) type in the following( C:/TC/BIN/TC.EXE) hit ENTER, wait for 5 seconds and then press f3 on the keboard. (2) rename it to ur choice, but the extension should be in cpp eg.. (3) test.cpp or code.cpp. it should not be in tect.c or code.c (4) there should be a #include<conio.h> header after #include<iostream.h> WHAT THE CODE DOES: this code …

Member Avatar
-3
8
Member Avatar

Hey, I could have posted this in my other thread, but i though this was strange enough to make a thread of it. So im still working on the program mentioned in my other thread, it runs with a main menu procedure. When the user selects a menu option, program goes to procedure, carries it out, etc, etc, and then comes back to the menu again. When this occurs, my program believes it is storing an additional 1, 2, or even 3 records in its text data file, when it actually isn't! I open my data file, the other questions …

Member Avatar
0
2
Member Avatar

My Object is to display a 24bit color .bmp picture in 24 bit colors via Turbo C Compiler. Turbo C can display only 16 colors so I will need to use a Windows Interrupt[or something like that] to display the image. I googled a lot but couldn't get a hint on how to proceed. I know how to display images in turbo C in 16 colors and etc. If Someone can guide me to the topics/books/websites/functions that will be used/ etc..... that can help me achieve my goal I will be very grateful.

Member Avatar
0
20
Member Avatar

For homework in turbo pascal I have to find a some bugs and refactor them. I need some help changing this so that it does the same thing which is to remove comments without the excessive code. [CODE]k:=0; for i:=length(s) downto 1 do if s[i]=' ; ' then k:=i; if k>0 then s:=lstr(s,k-1); [/CODE]

Member Avatar
0
4

The End.