turbo-c++

how to alternate colors in a circle, so that circle looks like rotating?

回眸只為那壹抹淺笑 提交于 2021-02-11 16:39:41
问题 The expected output should be like this with the colors changing their position as well: Expected output-: the colors should change their positions in a circle so that it looks like they are moving without changing the position of circle. though my code is written in codeblocks in c/c++, i will be happy to get answers in any other programming languages. my present code #include<graphics.h> #include<stdlib.h> #include<stdio.h> #include<conio.h> #include<math.h> #include<string.h> #include

Why should I not #include <bits/stdc++.h>?

主宰稳场 提交于 2021-01-29 08:42:33
问题 I posted a question with my code whose only #include directive was the following: #include <bits/stdc++.h> My teacher told me to do this, but in the comments section I was informed that I shouldn't. Why? 回答1: Including <bits/stdc++.h> appears to be an increasingly common thing to see on Stack Overflow, perhaps something newly added to a national curriculum in the current academic year. I imagine the advantages are vaguely given thus: You only need write one #include line You do not need to

Replacement to getch based code block in cpp

只愿长相守 提交于 2021-01-28 19:52:42
问题 I stumbled upon a code from 2016 written in the Turbo C++ IDE in windows It was to accept passwords char pass; for (length = 0;;) { pass=getch(); if (pass == 13) { break; } if ((pass >= 'A' && pass <= 'Z') || (pass >= 'a' && pass <= 'z') || (pass >= '0' && pass <= '9') || (pass == '!' || '@' || '#' || '$' || '%' || '^' || '&' || '*' || '(' || ')')) { str[length] = pass; ++length; cout << "#"; } } is there any replacement for this without the getch method for linux to show output like this ***

String problems with Turbo C++

怎甘沉沦 提交于 2020-05-16 02:05:30
问题 I need to get code work in Turbo C++. But the data type string does not work; using namespace std gives Compiler Error and I can't use string without it. Even std::string does not work. It works perfectly fine in Code::Blocks but I want it to work in Turbo C++. I know Turbo is a very old compiler and I should be using the new ones. But it is a college project which has to be done in Turbo C++. Are there any ways to make it work in Turbo C++? 回答1: This kind of depends on which version of Turbo

String problems with Turbo C++

我怕爱的太早我们不能终老 提交于 2020-05-16 02:02:10
问题 I need to get code work in Turbo C++. But the data type string does not work; using namespace std gives Compiler Error and I can't use string without it. Even std::string does not work. It works perfectly fine in Code::Blocks but I want it to work in Turbo C++. I know Turbo is a very old compiler and I should be using the new ones. But it is a college project which has to be done in Turbo C++. Are there any ways to make it work in Turbo C++? 回答1: This kind of depends on which version of Turbo

Run Turbo C++ in Freedos

ε祈祈猫儿з 提交于 2020-01-26 04:01:10
问题 I want to run Turbo C++ in FreeDos . I used to run it in DosBox but now I decided to test the FreeDos in my desktop PC. But every time I try run it the cursor blinks and nothing happens (after I enter the command and press enter) , the prompt does not return( C:> ) and I have to restart my system by pressing the power button. My question is: How can I actually run it? Does it require extra drivers or files? If it cannot be run, Do you any other C++ IDE? Maybe your own IDE? P.S. I have

want to create diamond shape using while in C

回眸只為那壹抹淺笑 提交于 2020-01-14 07:11:27
问题 i have created the diamond using for loop but i am not able to convert it into While. can you please help me to acheive the same goal using While loop. i tried while loop few times but it's running infinite time. #include<stdio.h> #include<conio.h> int main() { clrscr(); int i, j, k; for(i=1;i<=2;i++) { for(j=i;j<5;j++) { printf(" "); } for(k=1;k<(i*2);k++){ printf("*"); } printf("\n"); } for(i=3;i>=1;i--){ for(j=5;j>i;j--) { printf(" "); } for(k=1;k<(i*2);k++) { printf("*"); } printf("\n");

Linker Error: Duplicated Functions

北城余情 提交于 2020-01-05 03:36:56
问题 NOTE: I made a DFH_lib.CPP where I included fstream and iomanip. I kept all the template functions in DFH_lib.CPP. Now, if I write the remaining NON-TEMPLATE functions in the MAIN.CPP and include DFH_lib.h only then it successfully runs. I don't understand why... I was making a Data File Handling library using templates. I created two files: DFH_lib.CPP Lib_Test.CPP I made a project and clicked on "Build All" under compile. I encountered the following linker error: file_init(char near*)

Linker Error: Duplicated Functions

假装没事ソ 提交于 2020-01-05 03:36:10
问题 NOTE: I made a DFH_lib.CPP where I included fstream and iomanip. I kept all the template functions in DFH_lib.CPP. Now, if I write the remaining NON-TEMPLATE functions in the MAIN.CPP and include DFH_lib.h only then it successfully runs. I don't understand why... I was making a Data File Handling library using templates. I created two files: DFH_lib.CPP Lib_Test.CPP I made a project and clicked on "Build All" under compile. I encountered the following linker error: file_init(char near*)

Mouse program in Turbo CPP

给你一囗甜甜゛ 提交于 2019-12-28 02:16:28
问题 I have written a program in turbo cpp, which uses mouse for a basic GUI. I have also written a function that determines if the mouse has been clicked on a certain text displayed at a certain position. Everything works fine on the first run. But when i run the program, a second time a problem arises. Even when the mouse is just passed over an option(not clicking) it gets selected and the next page is displayed. Thanks again for those who answers. I am also attaching the code for mouse