Forum Replies Created
- AuthorPosts
- willParticipant
There is no such thing in C# instead you can create a public class in any namespace with Static Members functions like:
1234567891011121314151617<br />namespace GlobalFunctions //You can name it anything you want<br />{<br />public class ClassName //Name your class<br />{<br />ClassName bers() {} // Constructor for class<br />public static bool AnyFunction()<br />{<br />return true;<br />}<br />}<br />}<br /><br />//Use it in Other classes<br />using GlobalFunctions<br />bool isTrue = ClassName.anyFunction();<br />willParticipantHello
You will need to use this function recursively and mantain the visiting of the nodes. you will need to keep track of all the nodes which have been traversed and on that criteria you will call this dunction. At the moment you are just calling this function from any location and it gets stuck in loop. So in order to break that loop you will need a criteria to break the loop. And that criteria can be fulfilled by using another linked list or a variable which will hold the number of nodes traversed and then compare that variable with the actual number of nodes of the tree.
Hopefully this answers your question.willParticipantCan you show us the code you have written to generate the scope chart.
willParticipant@drop2kumar wrote:
Hi
the followiing code is giving 1 as answer but answer should be 0 …becoz 0.7 is not grater than 0.71234int main(){<br />float a=0.7;<br />printf("%d",(0.7>a));<br />}
Actually you are comparing the float type variable with a value which can be any thing. It can be an integer, float or any thing else. So in that case compiler does not know about the type.
Now if you explicitly mention the type of both the variables and then compare them the result would be according to your expectations. Hopefully this would clear your doubt.12345678<br />int main(){<br />float a=0.7;<br />float b=0.7;<br />printf("%d",(b>a));<br />printf("%d",(0.7>a));<br /><br />}willParticipantPlease refer to the post: https://www.mycplus.com/forum/forum_posts.asp?TID=225&PN=1
Which shows a small demo program of how to create a simple animation in C Language.
willParticipantHello
Refer to : https://www.mycplus.com/forum/forum_posts.asp?TID=225&PN=1
for graphics animation. Its a simple demo program which will give you an idea how to create the animation.willParticipantHello
Here is a portion of a program for “Bank managgement system” which I worte while I was in my Bachelors of IT. To make an animation in C Language you will need to create the image at run time and move that image on the screen. What i have done is created a bitmap using circles, arcs & different colors, and tried to make some sort of a logo, then put the whole graphics area in an image using getimage() function & used putimage() to show the image on the screen. To make an animation in C Language I have put this image in a loop which animates the image on the screen in scrolling mode.123for(int count=1;count<300;count+=2){<br />putimage(1+count,100,image,COPY_PUT);<br />}
Also I have made another animation which makes a complete line from a single point.12345for(int down=0;down<640;++down)<br />{<br />delay(5);<br />line(1,220,1+down,220);<br />}
And at the end I have made another animation effect using the line() function again.123for(int bottom=0;bottom<300;bottom+=4)<br />line(1,220+bottom,640,220+bottom);<br />
Below is the main source code of the complete animation. You can modify it according to your needs.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455#include<iostream.h><br />#include<conio.h><br />#include<graphics.h><br />#include<alloc.h><br />#include<dos.h><br />#include<fstream.h><br />#include<stdlib.h><br />#include<string.h><br />void main(void){<br />void *image;<br />int size;<br />int dr=9,mode=2;<br />initgraph(&dr,&mode,"..\bgi");<br />size=imagesize(140,140,500,250);<br />image=malloc(size);<br />setfillstyle(SOLID_FILL,GREEN);<br />circle(200,200,50);<br />floodfill(200,200,WHITE);<br />setcolor(LIGHTGRAY);<br />circle(200,200,19);<br />setcolor(WHITE);<br />circle(200,200,18);<br />circle(200,200,49);<br />circle(200,200,53);<br />circle(200,200,20);<br /><br />arc(215,215,350,90,30);<br />arc(210,182,90,194,30);<br />arc(180,195,180,300,30);<br />settextstyle(1,HORIZ_DIR,1);<br />setcolor(LIGHTGRAY);<br />outtextxy(270,180,"National Bank");<br /><br />outtextxy(270,185,"___________________");<br />outtextxy(270,210,"Of Pakistan Pvt Ltd.");<br />settextstyle(0,HORIZ_DIR,0);<br />setcolor(DARKGRAY);<br />outtextxy(270,240,"COPYRIGHT 2002");<br />getimage(141,141,499,259,image);<br />cleardevice();<br />for(int count=1;count<300;count+=2)<br />putimage(1+count,100,image,COPY_PUT);<br />for(int down=0;down<640;++down)<br />{<br />delay(5);<br />line(1,220,1+down,220);<br />}<br />setcolor(BLUE);<br />for(int bottom=0;bottom<300;bottom+=4)<br />line(1,220+bottom,640,220+bottom);<br />free(image);<br />getch();<br />closegraph();<br />}<br />willParticipantIt’s because of the improved security in Windows XP or Windows 200. The functions like
- inp() [/*:1cuthl9v]
- utp()[/*:1cuthl9v]
- system();[/*:1cuthl9v]
does not work on an NT platform.
There may be some other problems, but I think using win 98 would resolve the problem.willParticipantThanks spsinghs for explanations.
willParticipantwel its an endless discussion that what is best?
Answer to this question would be
Both are best (for the one who is using it) :)
Any how different people may have different ideas?
Lets see how people think about it?willParticipantAhsun that was a nice tutorial.
But it would be very best if you mention the website address from where you get that tuorial so that the users can have a look at it & may benifit from that site also.Any how Good work. Whenever you find any good tutorial please do post them here.
Thanks
SaqibwillParticipantwel I have made this website to help people like Zohaib who study C/C++ programming language. I am trying my best to provide quality material on this website.
like Tutorials, source code, free utilities and other contents.
Looking for any comments about the website from you people.
Thanks
SaqibwillParticipantSmart pointers are C++ objects that simulate simple pointers by implementing operator-> and the unary operator*. In addition to sporting pointer syntax and semantics, smart pointers often perform useful tasks—such as memory management or locking—under the covers, thus freeing the application from carefully managing the lifetime of pointed-to objects.
The simplest example of a smart pointer is auto_ptr, which is included in the standard C++ library. You can find it in the header
, or take a look at Scott Meyers’ auto_ptr implementation. Here is part of auto_ptr’s implementation, to illustrate what it does: 1234567891011template <class T> class auto_ptr<br />{<br />T* ptr;<br />public:<br />explicit auto_ptr(T* p = 0) : ptr(p) {}<br />~auto_ptr() & nbsp; & nbsp; {delete ptr;}<br />T& operator*() & nbsp; {return *ptr;}<br />T* operator->() &nb sp; {return ptr;}<br />// ...<br />};<br /></class>You can find many readings on smart pointers. I have found two very interesting readings on smart pointers.
http://ootips.org/yonat/4dev/smart-pointers.html
http://www.informit.com/articles/article.asp?p=31529 - AuthorPosts