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.