Friday, July 31, 2009

I have trouble with C programming converting from decimal to binary?

Hello, I am taking a programming class and I wrote the following program for C. I was unable to use the power function in the math library so I made my own, but it only works for converting from 0 to 1023, when I try 1024 the answer is wrong. I think it has something to do with the fact that 1024 requires 10 bits, but I dont know how that fits into the program's bug. thanks


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


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





int power (int , int);





main()


{


int deci, resid, binary, count, multiplier;





printf("input a number: ");


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





count=0;


binary=0;





if (deci%26gt;0)


{


while (deci%26gt;0)


{


resid=deci%2;


multiplier = (power (10, count));


binary=(resid*multiplier)+binary;


deci=deci/2;


count=count+1;


}


}


printf("0b%d\n", binary);


}


int power(int base, int exp)


{


int ans;


ans=1;


if (exp==0)


{


return ans;


}


else


{


while (exp%26gt;=1)


{


ans=base*ans;


exp=exp-1;


}


return ans;


}


}

I have trouble with C programming converting from decimal to binary?
.. I dont have a c complier any more so bear with me .. I'm doing this in my head.. But you are trying to take a binary number and you are representing it in a decimal form





meaning your answer may be "1001" = 9


but the var you are storing it into is seing 1001 = 1001


you are simply running out of space.. Convert your answer to char thus the answer = "1001\0" readable





hope this works


and I didnt run you out to the wrong conculision


Fd_set in ANSI C?

Why would gcc not understand the fd_set data type when compiling in ANSI C? Could it have anything to do with the unistd.h library? How can I fix this?


Thanks!

Fd_set in ANSI C?
If I remember well fd_set function (and similar) should be defined in %26lt;sys/time.h%26gt;, but your problem is more simple: fd_ family functions are not defined in ANSI C. Simple solution don't exist... because you should find a third parties library wrote in ANSI C that can be used instead of fd_ ones.








cheers


I can'taccess my control panel on win 98,it says C:\windows\system\lqcvi2.dll library files missing help

If you still have your original disc, insert it and it should have questions on what you want to do. Click repair. If this does not fix the problem, you will probably have to reformat your hard drive, then re-install your operating system.


If all this is a mystery to you, then if you do have to reinstall your operating system (Windows 98) then a very easy way to do it is buy the ezreload disc (www.ezreload.com) which will walk you through it. I am not associated with this company, but it is well worth mentioning for the non geek types.


How to do Differentiation in C programming language ??

I am looking for some tool, library or tutorials that would help me do differentiation in C or any other programming language.

How to do Differentiation in C programming language ??
usually differentiation includes variables...





so, it needs computation in variables...(not calculation)





but c language is mainly calculation...(using values assigned to variables)...





it is an NP complete problem to create a program which computes differentiation or integration of inputs...

garden centre

What is the best book to learn C programming for beginners?

Is let us C a good book? because i cant find it in the library. I tried seraching for it and there's no results. Is there a similar book like "Let Us C" that's easy to understand?

What is the best book to learn C programming for beginners?
Actually the best book for c is the book by Kernighan and Ritchie ..it descibes all the needed concepts in C language


or u can try com.lang.c FAQ on net it is filled with questions which help u to understand the language even better
Reply:hii..





you can try to search ebook in this site





http://www.freecomputerebook.net





find on the c sections








cheers
Reply:Let us ''C'' - Yashwant Kanetkar from a Indian Author.





One of the best
Reply:Try looking the ' for Dummies' series. Programming For Dummies or C Programming for Dummies. These books are very good at teaching you how to do programming in an easy to understand English.
Reply:The definitive C book is "The C Programming Language" by Kernigan and Ritchie. They created the language.





You might also find something that will teach you both the development environment and the language at the same time. When I was learning C++ I got a book like "Learn Visual C++ in 24 hours". It taught both C++ and the Microsoft Visual Studio environment in 24 lessons that each claimed to take one hour.





Shop around at Barnes %26amp; Noble where you can handle the books.


In C++ programming what dose function setw() do in this library <iomainp>??

That can be used to set the width precision of your output.





For example





cout %26lt;%26lt; setw(8) %26lt;%26lt; i;





would print i with an output width of 8 spaces.


2 simple programs in C++. & also a basic doubt. please make it simple as i am a beginner.?

C++ : should main() b defined compulsarily?can it b inside a class? also in array c[]={1,2,3} what will be c[1]?


define a class to represent a book in a library with datamembers: book number, Book Name, Author, Publisher,Price, no. of copies, No.ofcopies issued.


member function : (i) to assign initial values (ii) issues book after checking for its availability.


(iii) to return a book. (iv) to display book information.





Define a class ELECTION with the following speciations. with a suitable main() fumction also to declare 3 objects of ELECTION type %26amp; find the winner %26amp; display the details.


private members: candidate_name, party, votes_received


public memberfumctions: enterdetails()-input data


Display()- to display winner


winner()- to return details of the winner through the object after comparing the votes received by the 3 candidates.

2 simple programs in C++. %26amp; also a basic doubt. please make it simple as i am a beginner.?
"C++ : should main() b defined compulsarily"





Not sure what you mean.





"can it b inside a class?"





Not in C++, no it must be global. You can do this though:





int main(int argc, char **argv)


{


return Program.Main(argc, argv);


}





static class Program


{


static int main(int argc, char **argv)


{


return 0;


}


}





"also in array c[]={1,2,3} what will be c[1]?"





Arrays in C are 0-based, so c[1] is the second element, in this case the value is 2.





The rest of your questions sound like homework and I'm not going to ruin your learning experience.


When i try to open a folder or drive (c,d etc) a dialog box "cant load library from memory" is displayed!

Only when i click "ok" the folder or drive opens... Is this sign of any problem?If so what's the reason?

When i try to open a folder or drive (c,d etc) a dialog box "cant load library from memory" is displayed!
Try this:





go to a command prompt and type





SFC /scannnow

flower show

C# How can I connect a dll file from class library to a button?

I have a button and would like to connect that button with a dll class file library (a class added by 'add reference'). I already have code inside that class that I would like to be executed when the button is pressed. Basically, how can I connect button1 to a class....is what I'm trying to say.

C# How can I connect a dll file from class library to a button?
Once you added your class, you should add a "using namespace" declaration where 'namespace' is the namespace you used in your DLL.





In the event handler of your button, you'll be able to reach your code of your DLL the same way you reach the code you've written in the same project : If I created a DLL with a namespace MyDll and class Calcul containint a static function Sum, i'd access it this way : MyDll.Calcul.Sum()


In C++ programming what dose function setw() do in this library <iomainp>??

It specifies the width of the display field

In C++ programming what dose function setw() do in this library %26lt;iomainp%26gt;??
setw() function will allocate the space of the outputs in the screen or printer.


It you give


int i=100;


cout%26lt;%26lt;setw(5)%26lt;%26lt;i;


The output will be


100 // that measn right justified for numbers.


//left justfied for characters


cout%26lt;%26lt;setw(6,4)%26lt;%26lt;17.5


output will be


17.50 // totally 6 and 4 for decimals





check for your own coding. This will be useful.


Is C# a good platform for building games?

I'm interested in using C# to build my first video game. What interests me with C# is that it is fully object oriented and contains a wide array of codes in the .NET library. I'm thinking of designing a role playing game in C#, much like the Resident Evil series.





However, though it seems C# is up to the task of building games, I haven't heard much about developers using it which brings me to the question: Is C# a good platform for building games?

Is C# a good platform for building games?
I would say no. If you write a game using .NET functions, that requires the user to have .NET installed on their machine in order to run it.
Reply:yes
Reply:yea that what my dad uses
Reply:i don't know about c#, but c++ works great. then you can use directx or open gl, which are free graphics libraries. otherwise, making a game in c# is nearly impossible. i don't know how much experience you have, but c in general is very difficult. if you're a beginner, start with flash or vb.
Reply:only ameture games but still its better for just shows and animation
Reply:I personaly use Java, it's easy to use and it's cross platform. One of the major problems is deploying it to users but there are programs and methods that make it less difficult. I like to use it because it's easy, clean code, object-oriented, cross-platform, and applets are nice. Java has become quite advanced recently in the gaming area, there are libraries for OpenGL and joystick/controler input. It's my method, just be weary of the deployment.


I need help with my C++?

- I need Car rental system, Cd rental system, Library system, Restaurant system example.


- Must support with visual C++

I need help with my C++?
may be can find it at codeproject or sourceforge
Reply:May be you can contact a C++ expert to help you code your project assignment. Check websites like http://askexpert.info/
Reply:hihi.. thats a lot of systems.. well you must first fill us with requirements.. like the business rules.. :D hihi
Reply:http://www.a1vbcode.com/app-3962.asp





click to get similar project





http://www.planet-source-code.com/vb/scr...

phone cards

Basic C++ problem.?

Hi. I m just a begainer in c++. I m learning c++ by studying " c++ how to program" by Deitel %26amp; Deitel. I m using visual c++ 6.0. In the book there is a function " end1" under the library file %26lt;iostream%26gt;.


but I cnt use this " end1" in visual c++. when ever i use it it says, "end1 unidentified operation or end1 doesnt belong to %26lt;iostream%26gt; ."Is there a solution so that i can use end1 properly?


plz help me. your help will be much appreciated . thank you.

Basic C++ problem.?
sorry to remind u of ur mistake. infact whatever u r showing as 'end1' is 'endl', which means 'end line'; which can be used to substitue "C language '\n' " for ending the line.


it is not a function, but it is a macro.
Reply:Well I think its because you are using "1" it should be end l, a lower case L, in books it looks like a one. Hope I helped.
Reply:it is endl





well its 'L' in lowercase sometimes in some fonts it looks like "1" "one"


Bought a 350g WD. How do I move my itunes library there to open space on my C drive? Have laptop HP.?

External...USB connect...Move or copy...Read manual.


A C++ program?

Can you tell me any c++ programs or sites .


Programs like:


1.to make a library booking system.


2.ATM system


3.bank account


can I get the coding for such programs?


Any programs which will show the features of C++

A C++ program?
http://www.cprogramming.com
Reply:Or else may be you can contact a C++ expert at websites like http://askexpert.info/
Reply:what is it worth to ya?
Reply:Try using www.codeguru.com..
Reply:The implementation of the ATM simulation in C++ consists of eight modules that declare and implement the various classes - most consisting of an interface (.h) file that contains the class declaration(s) and an implementation (.cc) file that implements the methods declared in the interface. (No implementation file is needed for the class Status, and no interface file is needed for the main program.) Most modules implement a single class, but all the component parts of the ATM are grouped together into a single atmparts module, and all types of transactions are grouped into a single transactions module.





The current version of these files has been compiled and run on both a VAX/VMS system and a Linux system, both using gnu C++. A complete downloadable package of the all the source code will eventually be available via anonymous ftp. The README file in that package contains information about system specific details.


for libraries.


Free Compression and Archiving Libraries


Free Database Libraries, SQL Servers, ODBC Drivers, and Tools


Free Debugging Libraries, Memory Leak and Resource Leak Detection, Unit Testing


Free Edit Controls, Libraries and Source Code


Free Encryption Libraries


Free C/C++ Font Libraries


Free Games Programming Libraries and Source Code


Free Graphics, Image Drawing Libraries, 3D Engines, 2D Engines


Free GUI Libraries


Free Numerical, Graphs, Statistics and Mathematical Libraries


Free Sockets, Winsock, TCP/IP, Internet Libraries


Free Spell Checker Libraries and Source Code


Free Standard Template Libraries (C++ STL Libraries)


Free Thread Libraries


Free Audio, Sound, Music, Digitized Voice Libraries


All Other Free C/C++ Libraries





Bank operations using threads in java


New Visual C++ MFC Codes www.ucancode.net/index.htm
Reply:i think u can go ahead with any of the answers all will sound good


A C++ program?

Can you tell me any c++ programs or sites .


Programs like:


1.to make a library booking system.


2.ATM system


3.bank account


can I get the coding for such programs?


Any programs which will show the features of C++

A C++ program?
i'm not about to make you a program right here but you can go here for some tips tricks and learning tutorials





http://www.cplusplus.com/doc/tutorial/co...
Reply:#include%26lt;stdio.h%26gt;


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


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


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


void main()


{


int choice, a;


float money,m;


clrscr();


void deposite();


void withdraw();


//int func1();








cout%26lt;%26lt;"Student ID : TATA_12345"%26lt;%26lt;endl;


cout%26lt;%26lt;"NAME : RATAN TATA"%26lt;%26lt;endl;


cout%26lt;%26lt;"(1) DEPOSITE MONEY"%26lt;%26lt;endl;


cout%26lt;%26lt;"(2) WITHDRAW MONEY"%26lt;%26lt;endl;


cout%26lt;%26lt;"(3) FIND THE ACCOUNT BALANCE"%26lt;%26lt;endl;





cout%26lt;%26lt;"Enter your choice : ";


cin%26gt;%26gt;choice; /*read the choice*/





switch (choice)


{


case 1:


deposite(); /*to deposite money*/





break;





case 2:


withdraw(); /*to withdraw money*/





break;





case 3: /*to see the balance*/


cout%26lt;%26lt;endl%26lt;%26lt;"This facility is not currently available"%26lt;%26lt;endl;


break;





default: /*if choice is not valid*/





cout%26lt;%26lt;"ERROR// PLEASE TRY AGAIN";


exit(1);


}


getch();


}





void deposite()


{


float money;


cout%26lt;%26lt;endl%26lt;%26lt;"Enter the amount of money to be deposited(dollars.cents):";


cin%26gt;%26gt;money; /*read the amount to be deposited*/





if(money%26gt;0)


{


cout%26lt;%26lt;endl%26lt;%26lt;"$"%26lt;%26lt;money%26lt;%26lt;" has been deposited in your account"%26lt;%26lt;endl;


}


else


cout%26lt;%26lt;endl%26lt;%26lt;"Please enter valid amount......."%26lt;%26lt;endl;


}


void withdraw()


{


long int rem,f,t,e;


long int mon;


cout%26lt;%26lt;"Enter the amount of money to be withdrawn: ";


cin%26gt;%26gt;mon; /*read the amount to be withdrawn*/





if(mon%26gt;=20)


{


if(mon!=30)


{


f=mon/50; /*decides the notes of $50*/


rem=mon%50;


if(rem!=20)


{


if (rem==10||rem==30)


{


f-=1;


rem+=50;


}


}


t=rem/20; /*decides the notes of $20*/


e=rem%20;


if(e==0)


{


cout%26lt;%26lt;endl%26lt;%26lt;"Nos. of 50$ note : "%26lt;%26lt;f;


cout%26lt;%26lt;endl;


cout%26lt;%26lt;"Nos. of 20$ note : "%26lt;%26lt;t%26lt;%26lt;endl;


cout%26lt;%26lt;"TOTAL AMOUNT : "%26lt;%26lt;mon%26lt;%26lt;endl;


}


else


cout%26lt;%26lt;endl%26lt;%26lt;"This amount is not possible... Please try again"%26lt;%26lt;endl;


}


else /*if amount is not possible*/


{


cout%26lt;%26lt;endl;


cout%26lt;%26lt;"This amount is not possible... Please try again"%26lt;%26lt;endl;


}


}


else


{


cout%26lt;%26lt;endl;


cout%26lt;%26lt;"This amount is not possible... Please try again"%26lt;%26lt;endl;


}


}
Reply:See this website,





http://www.deitel.com/books/cpphtp5/cpph...

orange

Write a program in c for printf function instead of using printf library function?

I faced this questiuon in hoiney well plz reply anybody

Write a program in c for printf function instead of using printf library function?
#include%26lt;stdio.h%26gt;


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





void main()


{


char a[6]={'t', 'a', 'n', 'v', 'e', 'e', 'r'};


int i;


i=0;


while(a[i]!='\o')


{


putchar(a[i]);


}


i++;


getch();


}











compare this with the above program which is without printf function.








void main()


{


printf("tanveer");


getch();


}











Hope this will give you some idea or reference. The question is not asked specific to any integer printing or charter printing.


I have used character printing.
Reply:you can implement the printf() clone in many ways..


One way is to use putchar() method...


now you'll be wondering how to pass random number of arguments to our new function (let it be named myprint())..





In C we can write functions which takes multiple number of arguments...


how??





int myprint(int itemsToPrint, char [] type,...)





So now prototype is done..





We now just need to resolve the arguments which are to be printed.. For this we need to use few macros provided by most of the C implementations..


Using these macros we can access the arguments passed to our new function(i don't remember there name properly...)


Even printf/scanf uses those macro calls..


In our function first argument is the number of arguments to be printed.. Second argument is a character array which must contain the type of arguments which are to be printed in the order of appearance in the function call...





now if you are to print a character / character string using putchar is easy....


if you are about to print a float/int etc.. then convert them to character array and use puthar to print individual characters ...


How to implement sizeof operator in c lanaguage?

The sizeof operator is part of the standard library,but is it possible to


write a c program or function that does the job of sizeof?

How to implement sizeof operator in c lanaguage?
as the other person said, sizeof operator is evaluated at compile time, not run time.





basically, what it does is it looks at what you declared the size of a string to be, and returns that number.





example:


char str[100];


char message[] = "hello";


int size;





strcpy(str, message);


size = sizeof(str);


//size = 100;








if you want to know the actual size of the array then you can use strlen() function.


example:





char str[100];


char message[] = "hello";


int size;





strcpy(str, message);


size = strlen(str);


//size = 5;





can you write a function to dupe sizeof()?


im not sure why you would want to since sizeof() works for what it was intended to do. you could easily dupe the strlen() function though.





int strlen(char *str)


{


int length = 0;


while (*(str + length) != NULL)


{


length++;


}


return (length);


}
Reply:The sizeof operator is not part of the C standard library. It may look like a function call, but that is not what it really is. It is a unary operator of the C language itself, just like the unary minus operator. sizeof is evaluated by the compiler at compile-time, not at run-time.





It is technically possible to implement a function that has the same functionality as sizeof, but you would need to know a lot of intricate details about your compiler, and the function would need to have at least a slightly different syntax than the sizeof operator. For example the sizeof operator may operate on primitive data type identifers, like sizeof(int), but normal functions can't do this.


Graphics and music for visual c++ console applications?

Is there a way to add graphics and music(not just beeps) to CONSOLE APPLICATIONS in visual c++ ?


Or is there a way to setup a library of graphics and music to be compatible with visuall c++ (tell me the way to do it in details) :) thanks

Graphics and music for visual c++ console applications?
It depends on your version of Visual C++. Please add that.





That helps. Okay, the first link is a link to how to get the handle of the console window and to draw right on that window. Once you get a window handle, a window is a window is a window (mostly) so writing to the DC will work . Hope you know your DC stuff, because this is fairly low level for the windows world.


C++ help!!!!!!!!!?

i need a free compiler or the Microsoft C++ visual for download





but i'm using a library computer





so i was wondering if i can use a 1 gig memory stick to download the compiler on the stick, bring it home to my laptop ( no internet connection, and practice at home?

C++ help!!!!!!!!!?
http://www.bloodshed.net/devcpp.html





This is what you want. Should have everything you need, including a nice IDE. You shouldn't have any problems downloading it straight to your stick and taking it home.

flash cards

C++ project help?

Enter characters one by one until a predetermined “sentinel” or the maximum number of characters is entered. The maximum MUST be less than 96. The sentinel character can be any character other than an italic alpha or, space or a numeral (for example a # (pound) sign might be used).











Keep a frequency count of each of the italic alphas; upper and lower are deemed to be identical (FYI – in this context the term italic alpha refers to the alphabet used in the English Language, a thru ‘zed’). Also keep a frequency count of other characters entered; not each other character but characters other than italic alphas.





Output a frequency count of each italic alpha, and the others.


Determine which italic alpha occurred most often.


Output the stream entered in uppercase transposed form [ A becomes B , B becomes C etc; Z becomes A ].





Do not use any library functions.





How would I go about making this program?

C++ project help?
Done sir.
Reply:Well firstly, for outputting in uppercase, call toUpperCase() on the string or char Array.








Continuisly run the progam with a while loop. For example, while(string.length %26lt; 97)


{


collect input


if(exit character is entered)


break;


}





Italic Alpha...? Meaning?


Difference between library functions and user defined functions in c language?

Does the phrase "user defined" mean anything to you?


.

Difference between library functions and user defined functions in c language?
A user defined function is something you the programmer has defined to perform a specific action or calculation in your program.





Example, you need to calculate somebody's age to the nearest minute. You create a calculateAge function:





double calculateAge(Date dateOfBirth)


{


}





So it is specific to your needs at this time.





A library function has been written by someone else, and is reusuable by many programmers to solve the same problem over and over.





Example: strcpy in C. If you are using C, you will never need to write functions for string manipulation because somebody else did that a long time ago...

flower girl

A small library has exactly 3 books: A, B,&C.In how many ways can you check out none,some or all of the books?

This is a math problem given to me. I've come up with a couple different answers:( Can someone help, please?

A small library has exactly 3 books: A, B,%26amp;C.In how many ways can you check out none,some or all of the books?
For book A you have two options (to check it out or not check it out).





For book B you have two options (to check it out or to not check it out).





For book C you have two options (to check it out or to not check it out).





So to find out your total options you multiply your options for each book (this is known as the multiplication principle of combinatorics) and you get





2 * 2 * 2 = 2^3 = 8.





You could also of course list out all the possibilities, but it's easy to forget one (or more).





1. none or { }





2. {A}





3. {A, B}





4. {A, B, C}





5. {A, C}





6. {B}





7. {B, C}





8. {C}





In general if you have the option of checking out n books there are a total of





2^n





ways of checking out none, some, or all of the books.





Mathematically, this is equivalent to saying the number of subsets of a set of n elements is 2^n.
Reply:If all the three are different books :


none can be done in C(3, 0) = 1 way only that is checking out none.


one in C(3, !) = 3 ways i.e. either A or B or C.


two in C(3, 2) = 3 way i.e. either A,B or A,C or B,C.


all in C(3, 3) = 1 way only i.e. A,B,C.
Reply:1 way to check out none


3 ways to check out 1 = a, b , %26amp; c


3 ways to check out 2: ab, ac, bc


1 way to check out 3 : abc
Reply:1. none


2. A


3. B


4. C


5. A and B


6. A and C


7. B and C


8. A and B and C





In data management it is phrased as follows:


"x choose y"





3C0 = 1


3C1 = 3


3C2 = 3


3C3 = 1





Add these up and you get 8.


You can also get more answers for these "choose" questions by typing in "3 choose 1" (for example) in a google search


Would the library have season 1 of the O.C.?

Do they have like DVDs of TV shows and stuff?

Would the library have season 1 of the O.C.?
Gee I hope so


How to read Tiff file using C++ or C#?

Hi





am working on OCR in TIFF using C++ and C#, but am not able to open an tiff file Programmatically. i have downloaded libtiff library from libtiff website , but in Visual Studio C++ it is shownig link error as LINK : fatal error LNK1104: cannot open file "dlibtiff.lib".





Can any one suggest me what to do???





plz send me the dlibtiff.lib file to me





Am waiting for replay....





Plz help me ......

How to read Tiff file using C++ or C#?
- When you say you downloaded libtiff, did you actually build the source to get a static library?





- If you do have the binary built, did you mention the library in the linker settings? And the library path?
Reply:Hi i have builded and linker is also set but still showing LINK : fatal error LNK1104: cannot open file "libtiff.lib", can any one help me. Report It



Which library or sys call can I use to meassure the memory usage and cpu time consumption of a programm in c??

Im using a linux system (kubuntu) and need to compare two equivalent programms in terms of memory usage and cpu consumption.


I need to do it using c (gcc compiler)... not a utility or something like that

Which library or sys call can I use to meassure the memory usage and cpu time consumption of a programm in c??
Perhaps something in /proc could be helpful? or iostat?

curse of the golden flower

How to have graphics.lib library file and Graphics driver (BGI file) in the program folder in my Turbo C?

some programs includes graphics cannot run in my Turbo C, i dont know why. Please help me. Thanks.

How to have graphics.lib library file and Graphics driver (BGI file) in the program folder in my Turbo C?
In the IDE, go into the Options | Linker | Libraries


menu and check the 'Graphics Library' check box.


Wheres a good place to learn how to program with graphics in c?

I already understand c and I can use the windows.h library(not the graphics.h library though). Can you recommend a place on the internet where I can learn how to program graphics?





thanks

Wheres a good place to learn how to program with graphics in c?
OpenGL would be overkill for normal application.





Use QT, very easy to pick up especially if you have java background.





Visit there website, they have good tutorials





NOTE: QT uses C++
Reply:I would say Java, uses it's own language but it's similar to C. Download the compiler, sample code from www.java.com.





Another one is OpenGL, it uses C.
Reply:OpenGL.


RWhere can a person ,non specialist, learn to interpet their MRI and C-scan imaging films.?

Meaning:I have my films and i have to wait til next month to get doctors report. Is there somewhere ?, on line, library, ect. to find what a normal C-scan or MRI image would look like of your skeletal system especially your spine.

RWhere can a person ,non specialist, learn to interpet their MRI and C-scan imaging films.?
really, you would have to be in training to interpret it. i am in med school and have had anatomy and have taken an elective in reading mri and ct's and i wouldn't trust myself to read them. either try to bump your appointment up or do whatever you can to not think about it until then.
Reply:THere is no where else to go. even if you did take a med. Journal you don't know how to interpret it. You have to be in medical training for a couple of years just to egt the basics of it.


Is there a time function in C++ to calculate running time in microseconds?

I am looking for a time function which can help me to calculate running time for a block of C++ code in microseconds. I see time.h library but still not clear how to use them. What about gettick()?

Is there a time function in C++ to calculate running time in microseconds?
yup in c++ u have a time counter in time.h library. It is used for putting a delay of time in the execution of the program that is this gettick() ;delay() all these are used only to delay the execuion time but not to count the time in seconds.
Reply:delay() and gettick() can help you a lot. However if you need absolute time (for synchronous networking) you may need a third-part utility.
Reply:If your app runs on Windows and you are using some version of Visual C++ you can test the time that code takes to run to a very high degree of accuracy by using Kernel32.dll. A Microsoft article describes it here...


http://support.microsoft.com/default.asp...

apricot

Need help with a C++ program, I need to know how to make the program end when the statement is false?

#include %26lt;iostream%26gt; //Required for all C++ programs


#include %26lt;iomanip%26gt; //Part of the standard library for input/output, required for setw function


using namespace std;





int main() // Beginning of program


{


int choice;


double seconds,answer;


double speed;


bool validInput = true;





cout %26lt;%26lt; "\t\tMenu\n";


cout %26lt;%26lt; "---------------------------------------...


cout %26lt;%26lt; "1. Carbon Dioxide" %26lt;%26lt; endl;


cout %26lt;%26lt; "2. Air" %26lt;%26lt; endl;


cout %26lt;%26lt; "3. Helium" %26lt;%26lt; endl;


cout %26lt;%26lt; "4. Hydrogen" %26lt;%26lt; endl;


cout %26lt;%26lt; endl;


cout %26lt;%26lt; "Please select one of the gases from the list." %26lt;%26lt; endl;


cout %26lt;%26lt; "Enter your choice, 1-4: ";


cin %26gt;%26gt; choice;


cout %26lt;%26lt; endl;





if (choice %26lt;=0 || choice %26gt;=5)





cout %26lt;%26lt; "You did not choose a correct number please try again." %26lt;%26lt; endl;


else


(choice %26gt;=1 || choice %26lt;=4);





cout %26lt;%26lt; "Enter the time in seconds that the soundwave traveled between 1-30: ";


cin %26gt;%26gt; seconds;


cout %26lt;%26lt; endl;





if (seconds %26lt; 0 || seconds %26gt; 30)





cout %26lt;%26lt; "Sor

Need help with a C++ program, I need to know how to make the program end when the statement is false?
You have more than one area in which the user enters a choice, If you are asking how do you end your program at a point in which the user has entered invalid information,





switch your





if (choice %26lt;=0 || choice %26gt;=5)


cout %26lt;%26lt; "You did not choose a correct number please try again." %26lt;%26lt; endl;


To:


if(choice %26lt;=0 || choice %26gt;= 5)


{


cout %26lt;%26lt; "You entered invalid information" %26lt;%26lt; endl;


return 0;


}





The bottom switch statement you would add:





default:


cout %26lt;%26lt; "You entered invaid number" %26lt;%26lt; endl;


return 0;








Anytime you return from main, the program is over.
Reply:first of all you need a default case in your switch down at the bottom, but what statement are you talking about?


I can't use C++ in .NET?

when i put statement "#include ...." in C++ by .NET.it appear "could find in library"

I can't use C++ in .NET?
Are your compiler and linker options set to include the physical file folders where the header files and object files are located?
Reply:You can use C++ and .Net at the same time, you just aren't doing it correctly. Verify that the file exists. For system include files (like iostream) use %26lt;%26gt;, for regular includes use "".
Reply:your settings must be incomplete. ie. it could not locate files or headers etc.
Reply:learn C# instead of C++


How do I put my iTunes Library on my external hard drive instead of the main one? (local disk C:)?

I don't have enough space on the Local disk C: so I want to put it on my external hard drive. Makes sense right? But I'm having a hard time trying to figure out how to do it.


I hate iTunes! It's just all so complicated.





Can anyone help me? I've uninstalled the whole iTunes programme and consequently all my songs are gone (they are still in My Music though). But every time I try to install iTunes onto the external hard drive I get an error message and it tells me I need to have Windows XP (and I already have windows XP!)





Help me please?

How do I put my iTunes Library on my external hard drive instead of the main one? (local disk C:)?
iTunes is actually really simple. Just goto your my music directory and right click on the iTunes folder and select "cut". Then hightlight the folder you want to put it in on the external drive and right click and select "paste". This will move all the data to the external drive. Reinstall iTunes on the C drive, this does not take up very much space as it is only the program, not the data. Once you have installed iTunes, open iTunes and say no to all the questions it asks until you get to the iTunes interface.Once there, select edit, then preferences. Goto the advanced tab. In the general tab you will see "iTunes Music Folder Location". Next to the diaglog box select "change..." Now select the "iTunes Music" folder in the external drive as the location. Now restart iTunes and it should use the library that you moved and everything should be there.


Good Luck
Reply:All you have to do is change the music directory to your external hard drive.


I'm at the library looking at a sign with one word on it. It begins with C, and ends in N. What's the word?

Again: begins with C. Ends with N.





C............N.





I'm not telling you how long the word is. 10 points to the winner. I'll pick tonight around 11 pm.

I'm at the library looking at a sign with one word on it. It begins with C, and ends in N. What's the word?
Construction?





You didn't specify that the sign was inside the library!
Reply:connection
Reply:caution
Reply:wasnt on computer last night at 11pm so i would have to say caution
Reply:Canon
Reply:Children's Section?





haha. I don't know =p
Reply:Chain


Christian


Can
Reply:Christian, carton and cartoon come to mind
Reply:the word is


caption





i'm behind you..loll


nah nah


library...maybe children


xD
Reply:come in

song words

How are the living conditions in the norhtern part of VA near Washington D.C?

My family might be moving so that my husband can work in Washington D.C to the northen tip of VA, How are the schools, doctors, neighborhoods, churches, libraries, etc.? Just looking for opinions.

How are the living conditions in the norhtern part of VA near Washington D.C?
We just did a major relocation for my husbands job in DC from Cleveland to Manassas Park, VA. It is REALLY nice around here, schools are great. There is a high spanish population, but all of them are very nice.





We were shocked at housing prices, but everything else seemed the same as Ohio. There are many churches around here, but we haven't visited them yet. The library in Manassas (Manassas Park is a small town just outside of Manassas which is much bigger) is okay, but I've only been to the branch. It was the equivalent of the smaller branches from my home.





Once again, you probably will be shocked at housing prices, but you will get used to it. We are renting for $1700 a single family home. I think we kind of got a break on it. Expect to pay around that much for renting. To buy.....uh....there's no way we could do it.





We picked Manassas from a map and a realtor. My husband takes the VRE train in to town every day. This has turned out to be a blessing...the train has been reliable and very near to us. It saves us a ton of gas on travel (and time).





When we were moving I asked similar questions. A lot of people wrote about gangs being around the area. I am here to tell you that EVERYONE around here has been extremely nice and decent, and we have seen no signs of such goings on.





If you would like to know more, please feel free to email me. We've only been here a few months, but I totally know what it is like to go through this.





I have to say it has been such a great change for the better!





PS: The weather has been SO beautiful!!
Reply:I used ti live in west virginia and go to washington dc every time i could and i travel to va, it was quiet gray but good people. the national park services have many books about those places.
Reply:The tip or as it is called by locals Northern Virginia or No. Va is huge. Arlington and Fairfax Counties are consistently 2 of the best school systems in the Nation. There are many hospitals in No. Va but Fairfax Hospital in Fairfax County is unbeatable. It is ranked very highly by U.S News and World Report. I am from Fairfax County (the largest in No. Va and all of Virginia for that matter with over 1,000,000 residents.) and we have 21 libraries I used to volunteer at one and they are great. Depending on where you are coming from No. Va may be an adjustment and you may experience culture shock, because of the diversity, but that is what makes so No. Va amazing. The suburbs spread out forever around D.C so be ready for some major and I mean major traffic backups. Falls Church might be a great place to live they have their own school system (Falls Church Public Schools) and is close in to Washington, and is very historic. If you like shopping Tysons Corner is the way to go there are 2 malls with every store imaginable. Overall No. Va is an amazing place to live despite the gridlock. Hope this helps.





P.S No. Va has a very low crime rate especially in Fairfax County is very low.
Reply:Very nice, its big horse country up there, cost of living is rather high. My in-laws live 30 minutes west of DC in VA. I love it there aside from prices
Reply:Can you be more specific. The northern tip of VA near DC is rather large and encompasses a vast difference in cultures. Arlington is a nice city with lot's of shopping and is more residential than Rosslyn, with is also near DC. Rosslyn is considerably more expensive than arlington. Arlington, however offers more cultural diversity than rosslyn.
Reply:traffic sucks.. there is always traffic on 95. the area is nice but cost of living is high. lots of parks, schools, and hospitals. Fairfax is the best hospital. Potomac hospital sucks. if you get sick in the night you might as well wait until the morning togo to the doctors because you will be sitting there all night long anyway.Plenty of big libraries. Public transportation also.
Reply:We just moved to Sterling, VA, which is right across the Fairfax Co. line into Loudoun Co. So far we are enjoying it. Very low crime rate, and right by the Dulles Town Center mall.





I work in Sterling, but my wife drives to DC everyday. The traffic can get pretty bad, but she makes about 25 miles in 45 min. to an hour taking the toll road to the beltway.





As was mentioned, the biggest shock has been the real-estate prices. We pay $1400/mo. for a 2br apartment, and we got a deal on that. If you are going to rent, expect to pay anywhere from $1400 to $2000 a month. Average cost of a house is just under a half-million.





There is a large immigrant population in the area. If you enjoy diversity, then this is the place for you. Hispanic, East-Asian, and Middle-Eastern are the largest groups I have encountered.
Reply:Traffic sucks and it's way expensive to live. Many people end up moving to Fredericksburg or Stafford and commuting an hour or more to DC.


How can I compile a .dll using microsoft visual c++ 6?

I need to compile a Dinamyc Library that was originaly developed under Borland C, but now we need to migrate to Visual C++, and I would like to use the same code I used before. How can I compile a .dll using visual C++?

How can I compile a .dll using microsoft visual c++ 6?
Well u need to know how to make the dll workspace to work in it right ?





in your vc++ open new project and choose dynamic link library .. then import all you cpp and headers files into this new project .





finally just remove the default cpp file created with the new project that u don't need it anymore , and save yourworkspace and you can start compilation now .
Reply:Does it need to be recompiled? One of the strengths of DLLs is their reusability - you can write a DLL in C then import it into pretty much any language and use it quite happily, and this normally doesn't mean recompiling.


Hi just got a new p.c but i cant get on yahoo messenger its an asus pundit (LINUX) UBUNTU?

hi iv just got a new p.c but i cant get on yahoo messenger its an asus pundit (LINUX) i can use the web version but its not the same yahoo do have a unix version .................................


Other versions: Windows - Mac


Yahoo! Messenger for Unix


Send instant messages to your Windows and Unix friends!








Includes:





* Improved Emoticons


* Improved Message Archive


* Improved sound on RedHat kernels


* Yahoo! Address Book integration


* File transfer with Windows clients








System Requirements





Linux: Yahoo! Messenger runs on the Intel chipset and has been tested on RedHat 6.2, 7.2 and 8 and 9; Debian Woody





FreeBSD: Yahoo! Messenger has been tested on FreeBSD 4.5.





These packages require X Windows, GTK 1.2 or greater, openssl 0.9.6 or greater and gdk-pixbuf 0.8.0 or greater


Upgrading your Client





If you are upgrading your client from a previous version of Yahoo! Messenger, please remove the older version first before installing this version.





In addition, due to changes in the base libraries, please rename the preferences file in the directory $HOME/.ymessenger from .ymessenger/preferences to .ymessenger/preferences.old.





The new client will automatically configure your setup. You will not lose any offline or archived messages in this process.


Other notes





This client uses an un-GNOMEified version of GtkHTML 0.8, which is under the LGPL. Download the source.





Note: You can use the md5sum utility to verify the correctness of the downloaded file. The checksums are provided with each file.


Installation Instructions


RedHat Linux





1. Save the appropriate file to your machine:


RedHat 6.x


RedHat 7.x


RedHat 8.0


RedHat 9


2. Log in as root and type: rpm -i %26lt;filename%26gt; with the appropriate filename depending on your version to install the application.


3. Run /usr/bin/ymessenger from X Window to launch the application.





Debian Linux





1. Save the file to your machine.


2. Log in as root and type: dpkg -i ymessenger_1.0.4_1_i386.deb to install the application.


3. Run /usr/bin/ymessenger from X Window to launch the application.





FreeBSD Installation





1. Save the file to your machine.


2. Log in as root and type: pkg_add fbsd4.ymessenger.tgz to install the application.


3. Run /usr/bin/ymessenger from X Window to launch the application.

Hi just got a new p.c but i cant get on yahoo messenger its an asus pundit (LINUX) UBUNTU?
delete the messenger and delete all cookies in your pc.download messenger new.


PASCAL - C++ Migration help?

I need to know how I could convert integers into character in C++. As in PASCAL, we do it like this:





var a:char;


begin


writeln(chr(65)); {This will print 'A'}


writeln(chr(66)); {This will print 'B'}


a=chr(67);


writeln(a); {This will print 'C'}


end.





My question is : How will I do this on C++? I need to know the function and library used.








Thanks a lot.

PASCAL - C++ Migration help?
#include (iostream.h)


void main()


{char a;


cout %26lt;%26lt; (char(65));\\This will print A


cout %26lt;%26lt; (char(66));\\This will print B


a=(char(67));


cout %26lt;%26lt; a;\\This will print C


}

song titles

I want to download microsoft msdn library for visual basic and visual c++ can you give me a link?

MSDN is a subscription service. And you usually have to subscribe, or purchase Visual Studio with an MSDN Subscription. Once you do so, you get new releases of Visual Studio for free! =) You get a lot of stuff free before anyone else gets it when you subscribe to the MSDN Library.





But you CAN just use the online MSDN Library. I would recommend it if you don't have about $1,500 extra. =P I purchased Visual Studio .NET 2005 Pro + MSDN Premium. That was about $2,500. It about broke me. LoL.





But an individual MSDN-only subscription is only about $199, which isn't too bad. It just depends on what you're looking for. =)

I want to download microsoft msdn library for visual basic and visual c++ can you give me a link?
http://msdn.microsoft.com/ you have to pay them so i wouldn't bother downloading it, since they give ye full access online :D





R3dm0
Reply:you lazy one find it yourself .. search www.microsoft.com


Plzz SEND ME A C++ PROGRAM ON HOTEL MANAGEMENT OR MUSIC LIBRARY?

PLEASE SEND ME A PROGRAM ON HOTEL MANAGEMENT OR MUSIC LIBRARY AT THE LATEST FOR MY PROJECT WORK....


I WILL BE VERY THANKFUL 2 U....


PLEASE HELP...!!

Plzz SEND ME A C++ PROGRAM ON HOTEL MANAGEMENT OR MUSIC LIBRARY?
e-mail pls


A question about c++ and opengl?

I have learned c++ basics but i think i need to know what is a buffer so:


1.I need someone to explain to me what a buffer is and when we use it.


2.I want to start using opengl but i know nothing about it..... I use visual studio 2005 .... Is there anything i need to download before i start using opengl through visual studio?.... I need to


know how to open a new project and how to add the the libraries i need....


Is it a an advanced level to start making programs that have simple graphics... you know, like using buttons instead of writing commands and so on?


After you help me with the previous things, can you recommend a good tutorial to help me understand opengl... if not, is there a book instead of a tutorial?





NOTE: I use visual studio not visual basic.... Online tutorials helps you create opengl projects in visual basic!!


THANKS IN ADVANCE!!!

A question about c++ and opengl?
This looks like a good step-by-step tutorial for using OpenGL with visual studio 2005. http://www.cse.msu.edu/~cse872/tutorial1...





A "buffer" is a reserved segment of memory. For example, simply declaring a C++ array allocates a buffer. There are also different types of buffer classes that do different things. Some applications have sophisticated ways of using buffers to optimize performance. You'll need to be more specific in the type of information you're seeking about buffer.


Need help in C programming?

i need a c program that displays all factors of a number including one and itself. I can't use arrays, pointers, and strings. I am also not allowed to use other libraries... only stdio.h. help anyone?

Need help in C programming?
Use the mod operator %.





Remember 0 is equivalent to false, and anything else is equivalent to true in C, so you don't need to waste system time with a comparator like (==).





10 % 2 returns false, and that means it's a factor wile


10 % 3 returns true, and that means it's not a factor





the highest factor for any number is that number divided by 2, and the number itself and 1 will always be a factor.
Reply:Well the best way to do this would be to iterate from 1 through to the square root of the number desired. then divide the number by each one, test if fpart(number/possiblefactor) == 0. If it does equal zero then print the possible factor and the result of the division.





Finally check if the number is a perfect square and print that too if it is.
Reply:what is C programming

song downloads

Are there scientists who have a C grade point average?

I have a Bachelors Degree in General Biology. Although I have a C average, I still have a strong interest in the biological sciences. I have been visiting libraries and performing research at home, with some items I have. Are there any scientists who studied inside and outside of acedemic fields?

Are there scientists who have a C grade point average?
With a C average, you can become President of the United STates, but are not likely to be accepted for advanced scientific training at a serious academic institution.





However, you can take additional undergraduate coursework as a special student or candidate for a second Bachelor's degree. If you go back to school and "ace" it, and then do well on your GREs, a school may feel that you've shown that you are capable of advanced work, and ascribing your earlier grades to immaturity, and.be willing to take a chance on you.


Rcursion in C???

dose any one know how exactly to do recursion in C. i am trying to simply make a program to list files in a directory and recursivly goes through each sub directory and list the files they contain. i cant seem to get it to go more than one levle deep, because once i am down one level my check to see if the file i have encountered is a directory always returns 0. i am using the macro in the sys/stat.h and unistd.h libraries which is S_ISDIR(statBuffer.st_mode);


any help on this topic would be great

Rcursion in C???
You need to think about your exit return.





function yourfunction(isfinished)


{


if (isfinished==false)


{


do something if it's done isfinished=true


yourfunction(isfinished);


}


}


public void main()


{


bool isfinished='false';


yourfunction(isfinished);


}





Something like that.
Reply:Since your problem is that your function which checks if the element of a directory is itself ALSO a directory (You said it always returns a 0) Then I guess all you have to do is fixed that function and ensure that it recognizes a directory file from the other files in this way you can know when to go deeper (If you found out that the file is also a directory itself)


Graphics in UNIX with C++?

I'm trying to make a game in C++, but it's going to have to be in UNIX, rather than windows.





Are there any libraries I can use for graphics? (Unfortunately, I can't download any SDKs or anything)

Graphics in UNIX with C++?
X Windows





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





http://pangea.stanford.edu/computerinfo/...





http://www.x.org/wiki/
Reply:libsdl.org for sound, input, graphics etc.


opengl for 3d graphics


openal for 3d sound
Reply:http://trolltech.com/


Try using the Qt lib set


A few C++ questions?

Hey guys, just got a few c++ questions





1. What is an unsigned int?


2. When writing a boolean expression are numbers (other than 0) and "true" interchangable? (ie. bool a = true; is the same as bool a = 23;)


3. Can a float be an integer? (ie. float a = 6;)


4. What are substrings and how do you use them?


5. What order do you do commands like %26amp;%26amp;, || and ! in?


6. In relation to the commands above, what combos produce what? (f || t %26amp;%26amp; t || t yield what?)


7. How do you create random numbers (I remember my GSI telling us about special libraries that have to be called, what are they?)








Thanks

A few C++ questions?
1) The difference between signed and unsigned is how the computer interprets a particular bit pattern. For example, take an 8 bit byte.





If you tell the compiler this is an unsigned byte, the values range from 0 to 255. A signed 8 bit integer ranges from -128 to +127. unsigned integers are %26gt;= 0, ranging from 0 to (2^n) - 1.





2) yes. In any statement that takes a boolean expression (if, while, for. ?, until) any non-zero numeric value is treated as true and 0 is treated as false.





3) Yes, floats can represent some integers. Because of the float representation, there are some integers float cannot directly represent (though small integers are fine).





4) This is a very open question. Technically a substring is any inner portion of a source string. If you have a char pointer that points to a source string, you can make another pointer that points to somewhere inside the source string. What you do with it is up to you. You can parse for words, search for a token. Who knows what?





5) || has the lowest precedence, then %26amp;%26amp;, and ! is the highest of the 3





6) You didn't list any commands, so your example:


f || t %26amp;%26amp; t || t


%26amp;%26amp; is highest. t %26amp;%26amp; t -%26gt; t


f || t || t -%26gt; f || t





7) You call the standard library function rand(). Writing a good pseudorandom function is very difficult. Since computers are deterministic, the functions are not truly random, that's why they are called pseudorandom.
Reply:1. What is an unsigned int?


This is an integer value that is 0 or greater (ie: it does not include negative numbers).





2. When writing a boolean expression are numbers (other than 0) and "true" interchangable? (ie. bool a = true; is the same as bool a = 23;)


I think so. Its not 100% intuitive, but I can remember writing code like 'if (count) { //do something }', but its been a while.





3. Can a float be an integer? (ie. float a = 6;)


I think it has to be 6.0 (although assigning it to 6 might be okay, although it may be stored as 6.0). I am not 100% sure on that one.





4. What are substrings and how do you use them?


Substrings I think are just parts of a string. You can pull out parts and do what you want with them.





5. What order do you do commands like %26amp;%26amp;, || and ! in?


%26amp;%26amp; (and) and || (or) come in between logical arguments eg: (a %26amp;%26amp; B). ! (not) comes before !a





6. In relation to the commands above, what combos produce what? (f || t %26amp;%26amp; t || t yield what?)


f || t -%26gt; False or True = True


t || t -%26gt; True or True = True


(So I believe the entire statement is True)





7. How do you create random numbers (I remember my GSI telling us about special libraries that have to be called, what are they?)


I believe this is rand() or srand(int). The only difference is that srand takes a seed number that is used for calculating the random number. This is useful if you want to create a repeatable randomization. rand() always returns a different number. srand(100) always returns the same random number sequence.
Reply:1-





true = 1 false = 0


however something like this if (23){} a non-zero will be interpreted as true (non-NULL where NULL=0).





2-


unsigned int


The unsigned int type represents an unsigned integer comprised of 2 bytes. It has a range of 0 to 65535.





3- float a =6 is correct





4- a substring is a part of a bigger string. You can take a look at the String class to see how to manipulate strings.





http://www.cppreference.com/cppstring/in...








5- !(not) is always in front of a variable


when using a complicated expression its allways good to use brackets. If you don't use brackets the order is from left to right.





6- f || t %26amp;%26amp; t || l yield should never be used like this.


it should be something like this:


( (f || t) %26amp;%26amp; (t || l ))





7- the answer is described in detail and all different forms are also mentioned.





http://www.daniweb.com/forums/thread1769...
Reply:Hey, I am not sure about all of your questions, but I will try to answer them as best I can:





1. An int that does not have a sign, like 99, 53, 24. -5, -34, -67 all have signs, the '-'. Basically, just any non-negative number.





2. Not really sure, why not try it?





3. I am pretty sure it can, but would be a slight waste of memory to declare it as one, but not use it as one, plus the range of numbers floats can handle is smaller than ints im pretty sure.





4. Substrings are parts of other strings. So, if you have the string "Hello World", you could say that "Hello", "World", " ", "ello worl", "lo wo", or any other part of that string.





5 %26amp; 6. I am not really sure I understand you... first of all, %26amp;%26amp; and || are in a separate category of operators from !. Also, you can use parentheses to group logical statements. So, (f || t) %26amp;%26amp; (t || t) would return true, but I am not sure how it would go without the parentheses. Yet again, just try it!





7. I think you need stdlib.h, and you can use srand(int) to seed the generator, and then when ever you call rand(), a random number will be generated. Remember! Computers can not create random numbers! Thus, in order to create more true random numbers, always seed the generator with something that will be unique each time the program is run, like the current time/date in milliseconds. Try it! do:





cout %26lt;%26lt; rand();





three times inside of a normal program with iostream and stdlib included. You will get the same numbers each time!


Now, add srand(someInt); near the top, and be amazed!

sending flowers

Please help write c++ program to decide if the coefficients of a quadratic equation have real roots.?

write a C++ program to decide if the coefficients of a quadratic equation have real roots. The three choices will be to write the message “zero divide” when A is zero, write the message “no real roots” if the discriminant is negative and find the two roots when there is no error condition. DO NOT FIND THE ROOT IF THERE IS AN ERROR CONDITION.


use a NESTED DECISION to do the three parts of the algorithm above.


write a sentinel-controlled loop based on a character value to control the loop, q or Q will terminate the loop, any other value will continue processing. Read the value from the keyboard and write to the monitor. Use the inputs given below.


4. document the program properly, Use format for both the roots. Be sure to set the iosflags, setprecision, and showpoint. Use a setprecision of 3. also use setw for each numeric output.


libraries needed: iostream, cmath, iomanip. Add the .h, math.h for other compilers.

Please help write c++ program to decide if the coefficients of a quadratic equation have real roots.?
All you need to do is check the value of b^2 - 4ac. I leave precision, input/output, formatting for C++, etc. etc. to you. This is just the basic conditional statement that will be the heart of your program.





if (a = 0) {


zero divide


}


else if (b^2 - 4ac %26lt; 0) {


if (b != 0) {


imaginary


}


else {


complex


}


}


else {


real


}
Reply:if you are looking for the formulas:





zero - of course check the value of A,





discriminant = b^2 - 4ac and if the answer is 0 there is 1 root, if the answer is negative there are no real roots, and if the answer is positive there will be 2 real roots.





The formula for the real roots:





(- b + sqrt (b^2 - 4ac)) / 2 , and (- b - sqrt (b^2 - 4ac)) / 2


Thursday, July 30, 2009

How can i use third party library (.lib) file in a DOS C++ program using Borland Turbo C++ 3.1?

There are three things to do and a couple of points to check.





1). If the library is distributed in header and object code or as a premade .lib file, you'll need to simply include the header file in your project in appropriate places, add the object to a .lib file using tlib if needed, and add the library file in by the correct switch at link time.





2). Some .lib files will have a different format that isn't compatible with Borland products. These may be useful if source is included for the entire library. Otherwise, contact the vendor to get a compatible version or the source code to be compiled under your setup.





3). Some libraries are distributed as open source and must be compiled for use. Simply compile to object and then use tlib from Borland to create a new library file(.lib). Remember to include the correct header file(s) in any case.





The only other problems could arise from directory conflicts. Some libraries will need to be manually linked in with switches to use that particular file. Sometimes the header should be included using the double quotes and a filespec rather than by placing the new header in the include directory. Watch for naming conflicts, especially if using a C library since they weren't written using the new namespace standards. I hope this gets you going.


Where's a good place to learn how to program with graphics in C?

I already understand the basics of C, and I have a windows.h library, can you recommend a website where I can learn to program with graphics?

Where's a good place to learn how to program with graphics in C?
www.opengl.org/


Using Windows.h in C++?

hi, I'm a new c++ programmer who's trying to learn more about windows programming. I'm currently working with Visual C++ 5.0 Express and I've downloaded then installed the Platform SDK package. Unfortunately, I'm still having trouble including the windows.h package. I've been told that all I need to do is include the correct libraries..I just have no idea how to do that yet %26gt;%26lt;. Any help would be greatly appreciated. Thanks in advance.

Using Windows.h in C++?
The compiler doesn't know where to find windows.h. You can either put the whole path in front of the file name, or you can teach VC++ where to look. Eventually you'll need to link to the lib files too, so may as well configure VC++ to know where everything is...





I don't have 5.0 Express, so I can't tell you exactly what menus to look for. In my version of VC++, it's under Tools\Options. Tab over to directories, and add the include and lib directories for your SDK, and also the directories for your VC++ installation.





Here's an example, but you'll need to find the appropriate paths on your machine (hint. Just search for Windows.h, then copy the path)





Include files:


C:\Program Files\Microsoft SDK\Include


C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE


(plus I have lots more)





Lib files:


C:\Program Files\Microsoft SDK\Lib


C:\Program Files\Microsoft Visual Studio\VC98\LIB


(etc.)
Reply:#include %26lt;windows%26gt;





I don't use VC++ so I'm not sure what you're seeing...but in Borland and Metrowerks it really is as simple as the above.
Reply:use #include %26lt;windows.h%26gt;





windows is in include folder path .. not in the project..

send flowers

C++ coding problem?

we're learning functions in my C++ class, he's given us function main, we're to write sub-functions that'll complete the task libraries are just iostream. I need to return a value to be stored in the variable userInput, but i can't think of a way to do that without modifying the function main (which i'm not allowed to do) or adding a global variable(which i'm not allowed to do) I don't need the code, just a hint (sorry yahoo answers removes my spacing before my code)





// function get Input has already been declared





int main (void)


{


int userInput;


char letter grade;


char gradeSign;





cout %26lt;%26lt; "input number between 1 and 100\n (an invalid value terminates the program)\n";





while (getInput (userInput))


{


//unrelavant code that uses the variable userInput


}


}





//function i've written so far


int getInput (int getInputVar)


{


cout %26lt;%26lt; "Numeric grade: ";


cin %26gt;%26gt; getInputVar;


if (cin.fail() || getInputVar %26lt;0 || getInputVar %26gt; 100)


return 0;


else


return getInputVar;

C++ coding problem?
I am not positive what you are trying to do, are you asking how to let the "return getInputVar;" return to userInput? If so, there's a simple way to do it. Remember that you want the return value to return to something (i.e. using a =...). Hopefully that's enough of a hint.
Reply:1) how is the function "getinput()" declared? Is it declared with a return value, or no return value? example: int getinput() return value, getinput() no return value.





2) how is getinputVar declared in the arguments list for getinput() function? is it "int getinputVar" or "int* getinputVar"?





3)userinput is never assigned a value before being passed to the getinput() function (just poor programming practice, unless it is a pointer to userinput).
Reply:Can you access userInput from the getInput function you've wrote? Try adding userInput = getInputVar; just after the else and before the return statement at the end, and see if it lets you compile. The reason the program outputs random numbers for userInput right now is because you've declared the variable but haven't assigned any value to it yet, so the value stored at that spot in memory is just whatever happened to be stored there last time that memory spot was used by some program. This is called a garbage value because it means absolutely nothing to you or your program.
Reply:u can use main function to call that function and return its value in a variable as::








main()


{





var = fun( parameter list );





}





return type fun( parameter list );


{





return( what u want );


}





var and return type of function should be compatible


Where i can library management software or in this c program...?

Try these:


Hot do I convert Windows C++ to Mac C++?

I am trying to convert the final C++ project that I coded on my Windows to my Mac. I don't know if windows use different libraries but the build doesn't seem to work on my Mac. If it makes any difference I am using Virtual C++ Express Edition on my Windows and XCode on my Mac.

Hot do I convert Windows C++ to Mac C++?
If I'm not mistaken, Mac and Windows are not compatible as they use a different (binary) platform.





I imagine that you'll have to rewrite the Windows C++ to a Mac compatible platform.





It shouldn't be too hard, as I'm sure most routines are similar and then just do the debugging.





Good luck.


;-)


Can you include C++ source files in other ones?

C++ is really confusing me. I'm working on a project with a lot of files: source codes, header files, libraries. It is a jungle with tons of files, classes and structures that must be defined somewhere. I'm new to C++





What type of comunication can exist between C++ files? Can you declare classes or objects in one file and use it in another one? Or is it best to use functions? And can you call a function in one file from another?

Can you include C++ source files in other ones?
You define your function prototypes and/or class definitions in the header files and then implement them in the source files. The compiler is run against each source file and the included headers for each source file are copied into the source file. Then the compiler creates object/compiled code for the source file and spits out an object file. If another source file also includes the header file with functions implemented in another object file, the linker is provided with this information so that the external symbols can be resolved during linking. When you use an IDE such as Visual C++ this tedious stuff normally seen in a make file is all handled for you.





Basically just remember to put the definitions in the headers and implementation in source.





Example:





---------------------Stack.h----------...


#ifndef __STACK__


#define __STACK__





struct StackData


{


char Data;


StackData *Node;


};





class Stack


{


private:


StackData* m_Head;





public:


Stack();


virtual ~Stack();


void Push(char Data);


char Pop( void );


bool IsEmpty( void );


};





#endif





---------------------Stack.cpp--------...





#include "Stack.h"





#ifndef NULL


#define NULL 0


#endif








Stack::Stack(): m_Head(NULL) { /* Constructor */ }





// Destructor


Stack::~Stack()


{


while(m_Head != NULL)


{


StackData *OldNode = m_Head;


m_Head = m_Head-%26gt;Node;





delete OldNode;


}


}





void Stack::Push(char Data)


{


StackData *NewData = new StackData();





NewData-%26gt;Data = Data;


NewData-%26gt;Node = NULL;





if (m_Head == NULL)


{


m_Head = NewData;


}


else


{


NewData-%26gt;Node = m_Head;


m_Head = NewData;


}


}





char Stack::Pop( void )


{


char Result = '\0';





if(m_Head != NULL)


{


Result = m_Head-%26gt;Data;





StackData *OldData = m_Head;


m_Head = m_Head-%26gt;Node;


delete OldData;


}





return Result;





}





bool Stack::IsEmpty( void )


{


return (m_Head == NULL);


}





---------------------main.cpp---------...





#include %26lt;iostream%26gt;


#include %26lt;string%26gt;


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


#include "Stack.h"





using namespace std;





void main( void )


{


string sInput;


string sOutput;


Stack oStack;





cout %26lt;%26lt; "Enter a string: " %26lt;%26lt; endl;


cin %26gt;%26gt; sInput;





for( size_t i = 0; i %26lt; sInput.length(); i++)


oStack.Push(sInput[i]);





while(!oStack.IsEmpty())


sOutput += oStack.Pop();





if (sInput.compare(sOutput) == 0)


cout %26lt;%26lt; "It is a palindrome." %26lt;%26lt; endl;


else


cout %26lt;%26lt; "It is NOT a palindrome." %26lt;%26lt; endl;


}
Reply:You can #include "filename.cpp" to obtain a class(es)/functions, but I consider it poor programming. Typically you want to include only the header and link additional source file.
Reply:#include %26lt;file path%26gt;

quince

C++ programming?

write a C++ program to decide if the coefficients of a quadratic equation have real roots. The three choices will be to write the message “zero divide” when A is zero, write the message “no real roots” if the discriminant is negative and find the two roots when there is no error condition. DO NOT FIND THE ROOT IF THERE IS AN ERROR CONDITION.


use a NESTED DECISION to do the three parts of the algorithm above.


write a sentinel-controlled loop based on a character value to control the loop, q or Q will terminate the loop, any other value will continue processing. Read the value from the keyboard and write to the monitor. Use the inputs given below.


4. document the program properly, Use format for both the roots. Be sure to set the iosflags, setprecision, and showpoint. Use a setprecision of 3. also use setw for each numeric output.


libraries needed: iostream, cmath, iomanip. Add the .h, math.h for other compilers

C++ programming?
You forgot to post the question you wanted answered, you only posted your assignment.
Reply:Carefull. Last time she posted and I asked where the question was, she reported it. :)


Linking problem in VS2005 when compilig C++ code?

Hi, I just started using VS2005 for compiling my old C++ code, Actually I was trying to use the new VS2005 interface for my old code, I am getting error when ever I am linking a exe with a static library which in terms linked to other static libraries. But when I convert the exe type to static library its linking correctly. Can you please suggest me what could be the solution for this problem?

Linking problem in VS2005 when compilig C++ code?
nitpicking: you cannot have a linking problem when compiling code. you can only have linking problems when linking object files and/or libraries.





if you "convert" the exe to a library, then other libraries are ignored (a library usually does not include other libraries, unless you specifically say so). therefore the linker does not complain if other libraries are missing.





only exe files need all dependencies; if a dependency is missing, the linker will complain and stop linking.





if you don't post the error messages, it's hard to offer good help.


How to shut down or restart pc(windows) using a C program?

only C, not C++





please give me the code for starting %26amp; restarting pc


and tell the libraries to be included

How to shut down or restart pc(windows) using a C program?
You can use -





ExitWindowsEx (EWX_REBOOT, 0);





You might want the optional flag EWX_FORCE. This won't work from a command prompt on 95/98. You need to include windows.h and link with user32.lib for it.





If you don't have user32.lib you need to dynamically link to the function. Ask that as another question. If the user dosen't have the correct privileges this won't work. You need to call another function, ask that as another question.





Note: Microsoft will come around to your house and stand in front of the power button on your PC, because you're not allowed to turn it off. Naughty you. :o)


How are library functions usually packaged within a C program?

Thank u!!

How are library functions usually packaged within a C program?
with the complier..


..for various third aprty libraries, the object code of the fucntion (the .o file) is archived as a .a file on UNIX, and is copied in directories like /lib etc.
Reply:it is packed in a library shiped with compiler

garden centre

How to shut down or restart pc(windows) using a C program?

only C, not C++





please give me the code for starting %26amp; restarting pc


and tell the libraries to be included


and how to do linking if needed


i don't have user32.lib and windows.h


from where can i get it


thanks

How to shut down or restart pc(windows) using a C program?
windows.h and user32.lib can de found online at microsoft by downloading the visual c++ express edition. You can also get these files by downloading mingw and it w32-lib package.





To restart the computer in C do:


ExitWindowsEx(EWX_REBOOT,0);





to shutdown:


ExitWindowsEx(EWX_POWEROFF,0);
Reply:winuser.h


= http://doc.ddart.net/msdn/header/include... .html


Are library functions actually a part of C language.Explain?

Thank U!!!

Are library functions actually a part of C language.Explain?
Oh yes... see when u r so much into programming mindset... wouldnt it be irritating to repeat the bulky codings for a simple input and output statements... so only developers have written a common source codes for these and have included them in files called header files and they r called library functions 'cos they can be referenced by anybody any time......(called header 'cos they r at the top position), and its simple now... just include them in ur programs and u don have to repeat codes for clrscr(),printf(),scanf(),getch()... etc...


p.s: it is a chance we have '.h' as the extension for these files...
Reply:yes very much
Reply:Not all of them,..ANSI standrad C lists a set of library functions..(that are machine architecture independent) that are counted as part of C language..


while there are several other libraries that are not necessarially part of C language