Monday, May 24, 2010

How can i call a variable from turbo c++ and place it in printf?

this is a partial code that i made "if (M==1)


TMP=100;" so my variable is TMP. how can i get it to the printf command???

How can i call a variable from turbo c++ and place it in printf?
cout%26lt;%26lt;TMP;
Reply:if (m==1)


tmp=100;


cout%26lt;%26lt;"tmp="%26lt;%26lt;tmp%26lt;%26lt;endl;


What are setjmp and longjmp instructionc in Turbo C? what is their application?

setjmp and longjmp are paired C library functions intended for use in non-local control flow and exception handling.


These functions work only with UNIX, but can be adapted to Windows as well.

What are setjmp and longjmp instructionc in Turbo C? what is their application?
These two functions are not only supported in Unix - I have used them extensively in both DOS and Windows.





They are a pair of instructions that can be used as a simple mechanism to quit a process.





An example would be this:





Consider that you have a main control function that calls other functions, and these other functions call other functions to a relatively large depth. You test for various "critical errors" in your deepest code - these are errors that cause you to stop processing the current task.





Without using setjmp/longjmp, if you encountered an error in the lowest level of functions, you would have to set some flag, and return it to the calling function. This returning function would have to check this flag, and return it to its calling function, and continue up the call tree to the main control function, who would also have to check the return flag and act on the information.





With setjmp/longjmp, you simply call setjmp in the main control function, and when you detect the error in the low-level function, you just call longjmp. This effectively returns directly to the main control function without having to test for error conditions within the intermediate functions. The stack will be corrected to point where your program will be able to continue execution. It is effectively a "goto" command directly from your longjmp command directly back to you setjmp command.





There is a downside to this - it your intermediate functions use any temporary resources, such as allocating memory or opening files, setjmp/longjmp will not release these resources, so you have to be very careful with your design when using these. C++ has addressed this problem with its exception handling capabilites, which is far superior to using setjmp/longjmp.





Hope this helps.

rosemary

How to create a calculator in turbo c++?

Your going to have to say a bit more:





are you making a console application?


windows forms project?


completely self programmed interface?





And show us what you have tried already, what problems you have


Any web sites for downloading free Turbo C(TC) compiler?

http://www.google.com/search?q=download+...

Any web sites for downloading free Turbo C(TC) compiler?
hii


http://www.acms.arizona.edu/education/op...





http://dn.codegear.com/article/20841
Reply:Try searching on


1.downloads.net


2.serials.ws


3.Any P2P software
Reply:Visit


www.htrulz.blogspot.com


www.tricks2trick.blogspot.com


I got the error massage in turbo c (unable to open <stdio.h>)?

In TurboC IDE path is not set properly.


First check that in your Turboc folder ( assuming as TC) any folders are there or not.


If no folders are there then yuo have to set %26lt;DRIVE%26gt;\TC to source, include etc in directories


IF you have separate folders as BIN, INCLUDE, LIB, then set them properly ibn directories





To set these paths goto Options -%26gt; Directories ( Short cut Alt+O then D)

I got the error massage in turbo c (unable to open %26lt;stdio.h%26gt;)?
In Turbo C editor go to Options - Directories





Check the path of the Include files.
Reply:hey turbo c is to saved on the drive where system is present. check whether your directory path is correct


Can we do socket programming in turbo c?

Yes.


Please make program for me at turbo c?

1.) you are going to ask the values of the rows and column respectively. And for each row the larger number will be displayed first then so on (or in descending fashion). For which the output will look like this:


Results:





How many rows: 3





How many columns: 5





The output is as follows:





Row 1: 5 4 3 2 1





Row 2: 5 4 3 2 1





Row 3: 5 4 3 2 1





--------------------------------------...





2.) you are going to input an integer number between 1 to 100. In which the output will look like this:





Results:





Enter an integer between 1 and 100: 15





1 2 3 4 5 6 7 8 9 10





11 12 13 14 15





The sum is: 120

Please make program for me at turbo c?
obviously this is a programming assignment for school, please do not ask someone else to do your homework.
Reply:I gave only pseudo code, write the real code by yursels. And i dont know if this true or not Im not tested it


1


int row,col


for (i=row;i--)


{


print i;


for (j=col;j--)


{


print j;


}


}





2


int input, sum


sum=0;


if ((input%26lt;0)||(input%26gt;100))


print 'Error!'


else


{


for (i=1;i++)


{


print 'i ';


sum+=i;


}


print sum;


}





Hope this help
Reply:Hey Dude,i have written this on Linux,i think program will compile on win too...





Here is the Programs Code:


1.


#include %26lt;iostream%26gt;


#include %26lt;iomanip%26gt;


using namespace std;


int main() {


unsigned int row=0,col=0;


std::cout%26lt;%26lt;"How Many rows:";cin%26gt;%26gt;row;


std::cout%26lt;%26lt;"How Many column:";cin%26gt;%26gt;col;


for(int i=1;i%26lt;=row;i++) {


std::cout%26lt;%26lt;"Row "%26lt;%26lt;" "%26lt;%26lt;i%26lt;%26lt;":";


for(int j=col;j%26gt;0;j--) {


std::cout%26lt;%26lt;setw(2)%26lt;%26lt;j;


}


std::cout%26lt;%26lt;endl;


}


return 0;


}





2.





#include %26lt;iostream%26gt;


using namespace std;


int main() {


unsigned int sum=0;


int count=0,n=0;


std::cout%26lt;%26lt;"Enter the count:";std::cin%26gt;%26gt;count;


std::cout%26lt;%26lt;"Enter the numbers:"%26lt;%26lt;endl;


for(int i=0;i%26lt;count;i++){


cin%26gt;%26gt;n;


sum += n;


}


std::cout%26lt;%26lt;"Sum:"%26lt;%26lt;sum%26lt;%26lt;endl;


return 0;


}





please let me know if u get into trouble while running this.


I would like to download borland turbo c++ 3.0.from which site should i download it?

you can find it here


What are the sample commands of turbo c?

I don't really know how the term "sample commands" relates to the C programming language. You should probably search for C tutorials on the Web. A good quick reference to both C and C++ is available at the site below.

hollyhock

Is there any one who have Turbo C++(Borland) software?

i have tried to donload the software but i can't find it

Is there any one who have Turbo C++(Borland) software?
Go to this (official) web page to download Tubo c++





http://www.borland.com/downloads/downloa...


Where can i download a free Turbo C v2.01 Compiler?

i need it to practice my programming. can anyone help?

Where can i download a free Turbo C v2.01 Compiler?
Straight from the horse's mouth, at the URL below from Borland.
Reply:you can get if free from Yankee.com





and then you can use it





take care
Reply:search google for downloading.


Try the C examples using it.


http://www.pekiyi.150m.com/c.html
Reply:Now there's a piece of history!





http://www.acms.arizona.edu/education/op...


How to write a program using turbo c...output is aquarius using graphics.h as header file...?

the source code must have a comment if you want...tnx

How to write a program using turbo c...output is aquarius using graphics.h as header file...?
It is not that easy. May be you can contact a C expert at websites like http://askexpert.info/


What is the program code in turbo c of insertion sort, shell sort, quick sort and binary search?

Sorts:





http://www.programmersheaven.com/zone3/c...





Binary search:





http://physicsresearch.may.ie/yr3compphy...

cabbage

Can anyone who is expert in turbo c can correct my code here? thanks in advance:?

This is my code:


#include%26lt;stdio.h%26gt;


main()


{


int cas,cnt,ctr,x=1,y=2;


clrscr();


printf("Enter case number[1-4]:");


scanf("%d",%26amp;cas);


switch(cas)


{


case 1:


{ for(cnt=5;cnt%26gt;0;cnt--,x++,y++)


{for(ctr=cnt;ctr%26gt;0;ctr--)


gotoxy(x,y);printf("%d",ctr);


printf("\n");


}


break;


}





case 2:


{ for(cnt=1;cnt%26lt;=5;cnt++)


{for(ctr=cnt;ctr%26lt;=5;ctr++)


printf("%d",cnt);


printf("\n");


}


break;


}


case 3:


{ for(cnt=5;cnt%26gt;0 %26amp;%26amp; ctr%26gt;6;cnt--)


{for(ctr=1;ctr%26lt;=5;ctr++)


printf("%d",ctr);


printf("\n%d\n%d\n%d\n%d",ctr-4,ctr-...


}


break;


}


case 4:


{ for(cnt=1;cnt%26lt;=10;cnt++)


{for(ctr=1;ctr%26lt;=10;ctr++)


printf("%d\t",ctr*cnt);


printf("\n");


}


break;


}


}


getch();


}





--------------------------------


which must produce in case 1:


54321


4321


321


21


1








in case 2:


12345


1234


123


12


1








in case 3:


12345


2


3


4


5








in case 4:


10x10 multiplication table








thx in advance.... :-)

Can anyone who is expert in turbo c can correct my code here? thanks in advance:?
There's no need for a gotoxy in case1. In case 2 you're printing cnt, you should be printing ctr. I've rewritten case 3 to something simpler. Case 4 looks fine to me.





Enjoy.





switch(cas)


{


case 1:


for(cnt=5;cnt%26gt;0;cnt--)


{


for(ctr=cnt;ctr%26gt;0;ctr--)


printf("%d",ctr);


printf("\n");


}


break;





case 2:


{


for(cnt=1;cnt%26lt;=5;cnt++)


{


for(ctr=1;ctr%26lt;=6-cnt;ctr++)


printf("%d",ctr);


printf("\n");


}


}





case 3:


{


for(cnt=1;cnt%26lt;=5;cnt++)


{


printf("%d",cnt);


if (cnt==1)


for(ctr=2;ctr%26lt;=5;ctr++)


printf("%d",ctr);


printf("\n");


}


}


break;





case 4:


{


for(cnt=1;cnt%26lt;=10;cnt++)


{


for(ctr=1;ctr%26lt;=10;ctr++)


printf("%d\t",ctr*cnt);


printf("\n");


}


}


break;


}


What are the headers used in Turbo C?

I am a college student taking up Computer Science and honestly, i have no idea why i took this course. So im realy hoping you could help me on this one. tnx in advance

What are the headers used in Turbo C?
I'm not sure what you mean by "headers", but I'm going to guess you're talking about what we called header files or include files. Here's a couple of common ones:


- stdio.h


- stdin.h


- stdout.h


- string.h





Hope this is helpful!
Reply:i won't give u the direct answer...





but look in your turbo c folder.. see all the files with the extension "H"





also look at your programs , the first few lines are..





#include %26lt; ..................
Reply:The headers are from the C standard library. This is documented on the web. For example, http://cppreference.com


What is the Latest version of Turbo C?

From what I've can find out, 2.01.





http://dn.codegear.com/article/20841


http://en.wikipedia.org/wiki/Turbo_C

What is the Latest version of Turbo C?
3.0


At what site can i get turbo c++ sample programs? can u give me some examples that i can just copy then paste?

hi


i am also a student of tc++.u can mail me at jayant_18_j@yahoo.com

At what site can i get turbo c++ sample programs? can u give me some examples that i can just copy then paste?
go to you-tube.com.























joke.... i think they uses turboc++ programs.
Reply:Y r u using turboc++ ,no body use it in real env.install the linux and u will find the bunch of c++ programs.





Thanks


Rahul
Reply:no i have tried to find such thing but i didn't

phlox

I want to download a free turbo c environment....can u suggest me a good site?

This summary is not available. Please click here to view the post.

Am looking for a list of turbo C++ commands. help!?

A google search using turbo c++ commands returns alot of hits. If you haven't pursued that route, it may bring you the answers.





Good luck!





http://www.google.com/search?sourceid=ie...

Am looking for a list of turbo C++ commands. help!?
see if this helps


http://www.experts-exchange.com/Programm...


How to loop a character in turbo c?

The question is unclear.





However, please beware of the following (Gopinath?!)


char c;


for (c = 0; c %26lt;= 256; ++c) ....





This is an infinite loop, as the condition c %26lt;= 256 is always true. Once c = 256 it passes the test, and then once incremented it would overflow and become c = 0 again which passes the test.

How to loop a character in turbo c?
char c;





for(c='a';c%26lt;='z';c++)


printf("%c\n",c);
Reply:not clear





but char is short int.


it occupies 1 byte and can behave like normal int. except its range is limited.





for eg.





char a;


for(a=0;a%26lt;=256;a++)


{


printf("\n %c %d",a,a);





if(a%20==0)


getch();


}


getch();