Tuesday, July 14, 2009

Please help!!! C++ user defined funtions?

im trying to put some functions into my code. i want to create 2 functions in my switch statement one for case A and one for case B but im having trouble with my variables and the user input here is my code im open to any suggestions








#include %26lt;iostream%26gt;





using namespace std;





int main()


{





char choice; // variable for selection


int quantity; // variable for quantity of numbers


int num1; // variable for option A numbers


int num2; // variable for option B numbers


int largest; // variable for largest number


int smallest; // variable for smallest number





do


{ // beginning of do while loop





cout %26lt;%26lt; " Please choose one of the following options" %26lt;%26lt; endl; // instructions telling user what to enter





cout %26lt;%26lt; " A. - find the largest number with a known quantity of numbers" %26lt;%26lt; endl; //


cout %26lt;%26lt; " B. - Find the smallest number with an unknown quantity of numbers" %26lt;%26lt; endl; // display menu options to user


cout %26lt;%26lt; " C. - Quit" %26lt;%26lt; endl; //





cout %26lt;%26lt; " Please enter your choice: - "; //


cin %26gt;%26gt; choice; // ask user for input


cout %26lt;%26lt; endl; //





switch (choice)


{ // beginning of switch statement





case 'a': // case for when user selects option A


case 'A':





cout %26lt;%26lt; " A. - find the largest number with a known quantity of numbers" %26lt;%26lt; endl;


cout %26lt;%26lt; " Please enter the total quantity of numbers you would like to use: ";


cin %26gt;%26gt; quantity;





for (quantity;quantity %26gt; 0;quantity--)


{





cout %26lt;%26lt; " please enter a number - ";


cin %26gt;%26gt; largest;


cout %26lt;%26lt; endl;





for (quantity;quantity %26gt; 1;quantity--)


{


cout %26lt;%26lt; " please enter a number - ";


cin %26gt;%26gt; num1;


cout %26lt;%26lt; endl;





if (largest %26lt;= num1)


largest = num1;


}





}





cout %26lt;%26lt; " the largest number you entered is (" %26lt;%26lt; largest %26lt;%26lt; ")" %26lt;%26lt; endl;





break;





case 'b': // case for when user selects option B


case 'B':





cout %26lt;%26lt; " B. - Find the smallest number with an unknown quantity of numbers" %26lt;%26lt; endl;





cout %26lt;%26lt; " enter your first number - ";


cin %26gt;%26gt; num2;


cout %26lt;%26lt; endl;





smallest = num2;





cout %26lt;%26lt; " to get result and return to main menu enter (-99) for your number" %26lt;%26lt; endl;





while (num2 != -99)


{





cout %26lt;%26lt; " please enter another number - ";


cin %26gt;%26gt; num2;


cout %26lt;%26lt; endl;





if (num2 != -99)


if (num2 %26lt; smallest)


smallest = num2;


}





cout %26lt;%26lt; " the smallest number you entered is (" %26lt;%26lt; smallest %26lt;%26lt; ")" %26lt;%26lt; endl;





break;





case 'c': // case for when user selects to exit the program


case 'C':





exit('c');





default: // case for when user tries to select and option other than a, A, b, B, c, or C





cout %26lt;%26lt; " the letter you entered is not valid" %26lt;%26lt; endl;





} // end of switch statement





} while (choice != 'c'); // end of do while loop





return 0;





}

Please help!!! C++ user defined funtions?
create 2 functions called


void largest()


{


do all your things here;


returns nothing;


}


void smallest()


{


do all your things here;


returns nothing;


}
Reply:I see a problem with this section of code:


You are reading in a value for largest. That should only change when num1 is larger than largest's current value.





for (quantity;quantity %26gt; 0;quantity--)


{





cout %26lt;%26lt; " please enter a number - ";


cin %26gt;%26gt; largest;


cout %26lt;%26lt; endl;





for (quantity;quantity %26gt; 1;quantity--)


{


cout %26lt;%26lt; " please enter a number - ";


cin %26gt;%26gt; num1;


cout %26lt;%26lt; endl;





if (largest %26lt;= num1)


largest = num1;


}





}


C++, finding mode. It works - but is there an easier way?

void ord(double [], int);


int t, c = 0, count[50], p; double arr[50];


void main(){


cout %26lt;%26lt; "Postitive, 50 max, -1 to find mode)\n";


for (;;){


cout %26lt;%26lt; c + 1 %26lt;%26lt; ":%26gt;%26gt;";


cin %26gt;%26gt; t;


if (t == -1) break;


arr[c += 1] = t;}


ord(arr, c);


cout %26lt;%26lt; endl %26lt;%26lt; "Mode is: ";


int temp = count[1];


p = 1;


for (int i = 2; i %26lt;= c; i++){


if (count[i] %26gt; temp){


temp = count[i];


p = i;}}


cout %26lt;%26lt; arr[p] %26lt;%26lt; endl %26lt;%26lt; "Seen: " %26lt;%26lt; count[p] %26lt;%26lt; " times.\n";


system ("pause"); }





int f;


void ord(double arr[], int size){





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





for (int j = 1; j %26lt;= size; j++){


if ( arr[i] == arr[j] )


f++;}


count[i] = f;


f = 0;}}

C++, finding mode. It works - but is there an easier way?
Your code is super sloppy.





Get the array populated then do this:





int size;


int array[50];





// assume size is the array length and array[size-1] is the last element.








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


{





int count = 0;





for (int j = 0; j %26lt; size; j++)


{


count++;


}





cout %26lt;%26lt; "Element: " %26lt;%26lt; array[i] %26lt;%26lt; " count: "%26lt;%26lt; count %26lt;%26lt; endl;


}
Reply:????????????????????????????? dorks Report It



Is a c cup bra big?

well,i'm thirteen years old in the eigth grade and i am a 32 c cup.my friend is 14 and a 36 c cup.and we were having a talk about whether a c cup is big,small,or in the middle.she said that a c cup is big and i said that it is right in the middle.i just recently became a c.cup. i was a 34 b and now a i'm a c.all my friends are making a big deal about my size.and i don't know why.my other friend is a 36 double d yeah i said it,and she says that a c cup is small.what do u think?

Is a c cup bra big?
haha well considering that im almost 18 and im a 34 A !!! haha yeah they are pretty big for your age. ( to me at least =p )





p.s. i am so jealous!!! =p =]
Reply:You are about average (:
Reply:A C cup is average. Yup.
Reply:i believe it depends on your weight, heath and state of mind, and generally C considered medium
Reply:It's a little above Average. B is average.





Your kickin some girls butts.





=]





http://answers.yahoo.com/question/index;...
Reply:average but It depends on yuor body weight and height
Reply:its average
Reply:For me a C cup is big for a 13 year old...but thats because i'm a small B. It all depends on your figure.
Reply:I think C is average, there are big c's and smaller c's. A 36 c will look bigger than a 34c. Most girls also dont wear the correct size bra. You are very young, so I imagine they will still grow. So I hope you like em big
Reply:a c cup is medium to big. most 13 year olds are a b, but a 32c is not HUMONGOUS. but its not tiny either.
Reply:I think that for your age, you are a bigger average. I was very large at a 36 tripple D at your age. I now top out at 42 H. you are lucky to be the size you are.
Reply:i consider it big, not like ungodly huge, but very plump lol. considering i am a 34 A! and 16 yrs old!!! wooo and proud! hahah :)


Should I learn C before I learn C++?

I'm currently learning C++ as a hobby, but would love to find a programming job one day. I often see programming jobs that require you to have a background in C/C++.





Should I learn C before I learn C++? How difficult would it be to learn C later on after having programmed in C++ for a while?

Should I learn C before I learn C++?
Most programs like to teach C before C++. However, there is no reason why you shouldn't start with C++. One of the things people who start with C have a problem with is switching their thinking to an object oriented approach. I think if you start with C++ you can avoid this problem and I think going from C++ to C would actually be easier than going from C to C++.





If you go this route, make sure that whatever method you decide to use to learn, whether it be book or a course you enroll in or whatever, doesn't expect you to know C first. If they are teaching from an approach where they are building on C you may find yourself becoming frustrated.





Also I dissagree with Keena: I think it would be more like learning to ride a bike before learning to build it.
Reply:c lacks inheritance,polymorphism,classes, objects ,ect which is present in c++.........





ur idea would be like tryin to drive a bike b4 learning cycle.....lol......


u can , but am afraid it would be hard....
Reply:You should learn C++ first.


You will learn object oriented programming and you will have the opportunity to learn better practices, such as RAII. Also, the standard library in C++ does a lot more than the C standard library. You don't have to learn as much raw material before you can write a useful program. Most importantly, the C++ library does a lot of memory management for you (via container classes). Memory management is the most difficult part of C. Delaying that will get you up and running much faster.





In addition, raw C is not used much now, especially on desktop environments. It is used in specialized environments such as kernel drivers and embedded systems but stuff like that would be well in the future.





Once you know one language well, it is relatively easy to learn another. Going from C++ to C, you might miss the stuff you had, but it's not hard. You'll have to learn manual memory management, but it's not too bad once you have background.





Some of the best C++ learning books are:


C++ Primer 3rd ed, Stanley Lippman


The Complete C++ Training Course, Deitel %26amp; Deitel


You Can Do It- A beginner's introduction to Computer Programming!, Francis Glassborow
Reply:Just learn C++ because C is becoming more and more obsolete. C++ is one of the most prominently used languages out there and the language of choice in video games. C++ is a souped-up version of C, so learning C is pointless.
Reply:Yes it's always better to learn C first and I will explain why.





C is a very general purpose programming language. It is used to solve a wide range of programming problems. C++ takes it to another level by making object oriented programming a LOT easier while using the standard library provided by C. C does have advantages too such as a wide array of superior compilers to choose from.





You will not find C difficult after learning C++ because I learnt C++ 4 years before I even touched a C book. Personally, dealing with pointers in C was a pain in the neck whether you do it first or not you will have to do it at some point.





It's best to know both languages but just remember that 90%+ of all the programs out there can be written in either language.
Reply:C++ is EXTREMELY hard to learn. That is the reason why microsoft has invented C#. If you want to do something beneficial for your career learn C# instead. Ruby is also getting into demand %26amp; very user friendly. Forget C %26amp; C++ it is the PAST. Those 2 languages are use mostly in the research field but will dissapear.
Reply:I would lean towards C++. If you learn C++, then you are learning C with more features. C++ is just an extension of C, and you will probably find more job opportunities with C++.


Personally, I learned C first and C++ was extremely simple to learn afterwards. It would probably be the same if I knew C++ then tried to learn C.
Reply:I would suggest do your c++ first, because its a bit easier than C, when it comes to syntex of the commands that you need to write.


Once the logic of the code is clear to you.


You would find C quite easy to follow ...





The logic for both the land is the same but C is a bit more powerful as it gives you a bit more freedom with the assembly lang and hardware( but again slighly tougher than C++)...





my suggestion.. complete C++ and then C would be a cake walk for you.
Reply:in my opinion, you should learn C before C++





why? because it is easier and not that much "cryptic"


to understand than C++.. ^^





learn as much as you can in C, and when the time


that you're feeling that something (eg functionality, or


you cant code it easier) is missing while using C,


then its "time" for you to start to learn C++.. ^_^v





if you learn first C before C++, it is like


relearning C with some added functions


and another way to code a C program..





but the other way isn't.. if you first learnt C++ then C,


you may expect some functions to exists also


in C, which is often not.. why? because C is impossible


to be "backward" compatible with C++..





i hope you got my point.. peace out.. ^_^v
Reply:Ideally, you should learn C before C++ but you should be learning both at the same time.


Just to get a comparison between doing input/output statements and features in each language.


Or you can learn C then C++ then C# to see the differences in each language and the advantages of using each language.


It shouldn't be difficult to learn C after learning C++ but just having to remember that you cannot use 'class' in C and reference declarations.


In memory management, C uses malloc/free, C++ uses new/delete.


You don't need to cast a void* to pointer* where pointer is any type in C where as C++ requires you to do it.


C++ flags error where they are warnings in C.

easter cards

C programming book?

anyone pls tell me c programming book in tamil which is easy to understand?


who do not know in tamil , pls suggest c book in english?





also say for fresher interviews , what syllabus we hav to cover in c %26amp; c++?





how much time will take to complete c ?





thanks in advance!!!!

C programming book?
dude....try flazx.com
Reply:The first book i would suggest u is


"Progamming in c"-author-Balaguruswamy


following this book is easy





next very very very very interesting book is: "Let us C-author Yahwant kanikar"


While "programming in c by balaguruswamy" is easy to understand, Let us c book is also easy and very very very interesting with lots and lots lots of interesting examples... concepts of pointers,files etc are good in "let us c" book..





u can also refer schaum's programming in c





If u are fresher... And the time duration for fresher depends on their ability to understand concepts...





If u want to prepare urself for interview, and if u r non-computer student.... dont worry they wont ask u in deep about c... but u have to know what is what? its enough if u prepare a little on overall c. just learn what is what? like what diff between struct %26amp; union, what is a function,pointers,recursive function, file? what does a pointer,function,struct,union,files do?


what type of language is c? is it a structured or procedured language or such things....





Hope this helps a little!





All the very best!
Reply:I seriously doubt if any computer books come in languages other than English, especially the language books.


The only two books I have referred in my life are "Let us C" by Yashwant Kanitkar. This is the book, to start if you absolutely dont have any idea about what is C. The second book is Kernigham, ritchi. This is a must if you want to go deep and get all your fundaes clear. I will say before going to any C interview, have a look at this book.


Learning time depends on your grasping capability, and interest in subject, and also what you want to do. If you just want to write applications without knowing what happens inside compiler, learning the entire C language, will be matter of weeks. But if you want to get real champion, it can be matter of years. I am learning C from last 6 years.
Reply:how to c++ program for Deitel %26amp; Deitel
Reply:refer to Let us C -by yashwant kanitkar...


the time required to complete C depends on how deep u want to go in it n how much u r intrested in it.


for freshers interview prepare data structures becoz quests r mainly asked abt some DS algo..
Reply:for c language balagurusamy is good ,but for basic knowledge 'let us c'of yashvant kanitkar and 'c in depth' books are very good .


For good programming u have a good knowledge in pointer so give more concentrate in pointers.because in data structure programming


all prefer to use pointer for good programming .


For c++ I prefer mainly two books first ,'mastering c++' and 'reference to c++'.
Reply:Check out the book "OBJECT-ORIENTED PROGRAMMING WITH C++" by E. Balagurusamy --





http://highered.mcgraw-hill.com/sites/00...





To my knowledge the same author has written books on C as well.





If at all you are from Chennai, check out "Easwari Book house, T. Nagar", "Higginbothams, Mount road" or "Oddyssey in Adyar".





...Vadivel


http://vadivel.blogspot.com
Reply:u can read


black book of c ,Mulish Copper C,Dummy C Programming
Reply:The best C programming book ever:


The C Programming Language (Second Edition) by Kernighan and Ritchie.





The authors created the language. The book is concise yet complete. You will find yourself going back to this book time and again, even after you have mastered the language.


3rd c-section, need advice?

I'm the mother of 2 boys and they were both c-sections the 1st time they induced my labor but my son was so big that he dropped fast and got stuck behind my cervix so they had to do an emergency c-section. (he was born 9 pounds 6.25 oz and was 22 1/2 inches long) The 2nd time despite the doctors efforts my 2nd son had refused to come out and they had no choice but to do a c-section. (he was 8 pounds 0 oz and was 21 1/2 inches long) the doctors are wanting to do a 3rd csection with this baby on 5/4/07 ( my 2nd born son's 2nd birthday)... I'm scared to have another c-section I remember all of the pain I went thru and the difficulty recovering. I want to have this baby natural but they claim it's too dangerous, has anyone else been thru this and had a normal vaginal delivery after multiple c-sections and what should I do about being scared of having another c-section. Should I try and talk my doctors into vaginally delievering anyway or waiting until its 2 late 4 them 2 do a section?

3rd c-section, need advice?
You can DEFINATELY have a VBAC. The least amount of medical intervention possible is always the best course of action. Learn all the risks of VBAC to see if it is right for you- it IS dangerous but SO IS normal labor.. SO IS a c-section.





You can tell your doctor you are going to try normal labor and see how it goes. If your doctor does not work on VBAC patients- find another.


C++ ,c++????

i've finished the tutorial for c++, the name of the tutorial is cpluscplus in .pdf format, then what?? and i cant see any thing that is relating windows applications and c++, like shutting down the pc with c++ code.. could u tell me how to improve my skill concerning windows with c++??,sorry if my question is rude, thnx for ur cooperation!!

C++ ,c++????
C++ is not a Windows PC language only. It is an utterly general language with compilers that target (almost) every (programmable) device and OS known to man. It is not surprising that a good, general introduction to C++ would not discuss or even mention Windows or PCs. C++ can be run on PCs, servers, mid-range, and mainframe boxes.





If your interest is Windows PC programming in C++, try:





http://www.relisoft.com/win32/index.htm


http://www.developers.net/all_content/Co...





You can get a bare-bones Visual C++ development tool from Microsoft at:





http://msdn2.microsoft.com/en-us/express...
Reply:Check out these links:





www.functionx.com/win32/index.htm





www.cs.sjsu.edu/faculty/pearce/mfc/ (Microsoft Foundation Classes, an older technology use to interface the windows api from c++)





en.wikipedia.org/wiki/C++/CLI --a good starting point to learn about c++/cli, MS's new c++ flavor geared toward the .NET platform.





But if you really want to program windows, start looking into c#. It is based on c and c++. You will learn it in a flash. Then you can program windows through the .NET framework, where much of the windows API has been made easy to work with.
Reply:C++ is very powerful programming language . don't you know that they embed it on IC's .


C for beginners problem....supposed to determine output of relational operators?

My homework asks "What is the output of the following?" and i'm thinking something is horribly wrong with this code or they skipped this in class.





the only thing vaguely tickling my brain is the true/false (1 or 0) thing. but if that's so, i didn't realize you could assign 1 or 0 to integers using true / false tests.





int main()


{


int a = 3, b = -1, c = 0, i, j, k, n;


i = a || b || c;


j = a %26amp;%26amp; b %26amp;%26amp; c;


k = a || b %26amp;%26amp; c;


n = a %26amp;%26amp; !(b || c);


printf("\ni = %d, j = %d, k = $d, n = %d\n", i, j, k, n);


}

C for beginners problem....supposed to determine output of relational operators?
Actually, this code prints out 1, 0, "$d", and 1 (k's value after "n ="), because you have "k = $d" instead of "%d". The output is:





i = 1, j = 0, k = $d, n = 1





Unless that's your typo, maybe you are being taught the value of matching up printf arguments. :-)





If you meant "%d", it's:





i = 1, j = 0, k = 1, n = 0
Reply:C treats anything other than 0 as true even negative values as true.


so if you write anything like i=2%26amp;%26amp;5 it sets value of i to 1.


so i=1 bcoz a and b are true, but j=0 boz of c which is zero means false.


%26amp;%26amp; operator has higher precedence than || so it is true again and hence k=1.


not operator has highest precedence. b||c=true as b is non zero


!(b||c) is false which when anded with a gives false setting n to 0


hence


your result is


i=1


j=0


k=1


n=0
Reply:C has no real concept of true and false. 0 is false and everything else is true. As a matter of fact and (%26amp;%26amp;) is an operator that says if either operand is 0 then return 0 otherwise return 1. Or (||) is an operator that says if either operand is not zero then return 1 else return 0.





This is the concept your teacher is testing you on with this question.
Reply:i = true


j, k, n = false





I think, just by looking at it.





Now, integers can be booleans; %26lt;= 0 is false (example, 0 and -1 are false, anything 0 or below)


And a true integer is anything above 0.

brenda song

10500b.c. 3500b.c. 2700b.c. 355b.c. in iraq, 270b.c. the trinity for juno jupiter's wife, rome, 167b.c.hebrews

never can god be more then 2 ONLY 1 ALMIGHTY BRAIN, SO IT IS YOU GET A BIT AND THEY GET A BIT 50 SOME RELIGIONS AND ALOT OF BOOKS JUST TO FIND THE LIARS THERE OF. HUMANS=70% WATER AND 30% OF THE EARTH=1 SOUL=ALL THE SAME BORN INTO SPIRIT OF ERROR AND NEED A FLOWING RIVER WATER TERNSFER TO CONVERT TO THE SPIRIT OF TRUTH, WHO, WHAT, WHEN, WHERE, AND WHY. TO STEAL A LIE ( 70A.C.) AND HOLD IT AND ADD TO IT DOES NOT MAKE ALMIGHTY BRAIN A HAPPY CAMPER. THE USA HAS SPENT 320 BILLON DOLLARS ON THE WAR SO WE CAN BE POOR AND HOMELESS, 1776 GREAT BRITIN TOOK THIS LAND SET UP THE ERROR GOVERNMENT TO RAPE THIS LAND AND MURDER TO DO IT. THE PROUD WORK FOR SATAN WHY BECUCZ THE 38 MILLON MILE WIDE ALMIGHTY BRAIN SAID IT. THE ONLY FREEDOM I HAVE IS TO FREE SUCK IN ERROR SAD SAD IS THE TIME WHEN THE ALMIGHTY RETURNS AND THE PAY BACK STARTS.

10500b.c. 3500b.c. 2700b.c. 355b.c. in iraq, 270b.c. the trinity for juno jupiter's wife, rome, 167b.c.hebrews
You fell out of your tree again, didn't you. Hit your head on the sidewalk?


Turbo c , c++ related?

im using turbo c version 2.0 and turbo c++version 3.0 in win xp.i need to know is there any latest versions in c, c++. where we can download for free?many saying there r different types of c. what r they?

Turbo c , c++ related?
actully the basic concept of C language is standered, but u can use different compilers and IDE to implement them.


there r many compilers available, few of them are ..





Solbourne - Solbourne C++ Cfront Translator and Native Compiler.


Microsoft - Visual C++, Microsoft C7 Compiler.


Lucid - Lucid C++ Compiler and Energize Programming System.


GNU - Gnu C++ Compiler.


AT%26amp;T - AT%26amp;T C++ Cfront Translator.


Zortech - Zortech C++ Compiler.


SCO - SCO C++ Cfront Translator.


Comeau - Comeau Computing C++.


Sun - SunPro's C++.


ObjectCenter - CenterLine Software Inc.


EDG - Edison Design Group.


Borland - Borland C++ Compiler.


Turbo - Turbo C++ Compiler.


LIANT - LIANT LPI-C++ Compiler.


Objectworks - Objectworks\C++ 2.4a from ParcPlace.


Oregon - C++ compiler marketed by Taumetric Corporation.


IBM - Some IBM C++ Compiler.


JPI - JPI Topspeed from Jensen and Partners Int.


DeltaPro - DeltaPro C++ Compiler Release 3.1.





VC++ is good compiler for advanced user, Turbo is good for begginers.


u can google them ..
Reply:visual c and visual c++
Reply:Dev C++ is better than Turbo C.


http://www.bloodshed.net


C/C++ EXERTS? A little bit of help?? How would I encrypt/scramble a simple text file?

I am sending a text file and I want to just scramble it?





Here is my code?





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


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





#define CNTRLZ 0x1A





char sourceFileName[] = "H:\\text.txt";


char commStreamName[] = "COM1";


FILE *commStream;


FILE *SouceFile;


char charToSend;


char ReadAccess[] = "r";


char WriteAccess[] = "w";


char errorMsg[] = "fail to open data file\n";


char fileopenflag[] = "r";


char EndOfFile[] = "EOF";





int main(void) {


FILE *fp;


FILE *dp;


int c;





if ((dp = fopen("COM1", "r")) == NULL) {


printf("fail to open COM port\n"); return 1;


}








if ((fp = fopen( sourceFileName, "w")) == NULL) {


printf("fail to open data file\n"); return 1;


}








while ((c = fgetc(fp )) != EOF) {


fputc( c, dp);


putch(c);





}





fputc('*', dp);


fclose(dp);


fclose(fp);


}





Where abouts would the code go and how would I define it?





Any examples please? I'm a noob.

C/C++ EXERTS? A little bit of help?? How would I encrypt/scramble a simple text file?
I wrote an XOR (the ^ character) that would encrypt/decrypt to a string. Sadly I just it, but use an XOR. If you use a long string, it can be very hard to decrypt without the key.


C:\windwos\system32\config\sys... corrupt/missing? help with ADMINISTRATOR PASSWORD on recovery console?

error:


windows could not start because the following file is missing or corrupt: c:\windows\system32\config\system





since the file "system" does not exist in the folder config and the c:\windows\recover folder, and found system.bak in c:\windows\recover, i typed this(since i read in the forum that this might fix the problem):





copy c:\windows\recover\system.bak c:\windows\system32\config\system





1 file(s) copied





so i restarted my laptop and it went througn the windows page but then this error dialog box appear and says:





"when trying to update a password, this return status indicates that the value provided as the current password is incorrect"





so i went back to the recovery console and tried to fix this again but now it would ask for ADMINISTRATOR PASSWORD which i have no clue what it is.





does anyone know how i can get pass through this? i really need my laptop for my final examinations coming this march :(





thank you

C:\windwos\system32\config\sys... corrupt/missing? help with ADMINISTRATOR PASSWORD on recovery console?
contact: http://www.jjnavsofs.we..bs
Reply:Try using this command line utility





http://technet2.microsoft.com/windowsser...





its a standard command line tool used in windows you don't have to download anything. Just follow the syntax and don't worry about your password hassle's. You should be good from there.
Reply:What brand of computer do you have and what operating system
Reply:if its the Admin password your after?


Download trinity Rescure kit.


burn it to a Cd


place in your Laptops cd drive, and boot it up


Run in defualt mode


Type : winpass and press enter


This will access the admin account.


And if working correctly.....


it comes to a point where you have to type again. And it will say something about passwords


type either * or a new password and press enter. Then type reboot and press enter again, and remove your CD.


This will change the admin pass if done correct. More detailled instructions can be found on TRK home page.





http://trinityhome.org/Home/index.php?wp...





But if the admin account is a hidden one (havent worked out how to get into them yet) You can change it but still not access it. Hope this helps, This kit can be used to fix other parts of windows, once again more details on the website provided.

bouquet

About C.A And CPA?

i am a high school students and i am senior and next year i am going to college but i am worried about my major i can't decide wat major can i do i am very good at math and wondering to do C.A but i don't have any information about C.A can anyone give me detail about C.A and wat they do and wat is C.P.A and which one is good. can i earn more money by doing career in accounting. and i heard that after doing C.A and C.P.A i can do MBA in Finance is that good. please help

About C.A And CPA?
Sagar - Math does have a role to play in accounting, but a very small one.. If you think you have business acumen, you should opt for a career in accounting. As regards your question to CA/CPA, the CPA gives you a practicing opportunity only in the US. However you could provide US GAAP related consultations in India and make a decent living. Accounting is a lucrative career option but you have to pay your dues (CA takes about 3 years of your life easily, if you manage to clear all levels in the first go).


Converting a program from C++ to C?

Basically I have a C++ program that I am trying to convert into C. I have no knowledge of C but from what I have gathered on the internet I have made a few changes to my program. However, I am assuming that my program does not compile with C. Therein lies my other issue; I am using a windows XP operating device with a C++ developer software, but I have no compiler for C.





Does anyone know where I could find a compiler for C so that I can check my code and make sure it compiles correctly?





Also, in Additional Details I will provide my program and if you can spot anything that would utterly fail in C, please let me know. Any advice and help is greatly appreciated.

Converting a program from C++ to C?
You assume incorrectly. There is nothing in the code posted here that needs to be converted. There a couple of omissions through.





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





double convertTemp(double);


void printDate(char []);








int main()


{


const int SIZE = 10; /*change this to whatever*/





char type[SIZE];


double sum = 0;


int count = 0;


double test = 0;


double temp[SIZE]; /*fill in before calling convert */


char date[12]; /*fill in before you print*/





printDate(date);


convertTemp(test);


}











double convertTemp(double temperature)


{





double celsius = 0;


celsius = (5.0/9)*(temperature-32);


return celsius;





}








void printDate(char date[])


{


printf("%s\n", date); /*print statement */


}
Reply:If you have C++ code and a C++ compiler...why not just keep it as C++?
Reply:Your code will compile and run in standard C except that it won't do anything useful :-P





Good free C compilers:


MinGW - http://www.mingw.org/


Pelles C - http://www.smorgasbordet.com/pellesc/


Open Watcom - http://www.openwatcom.org/
Reply:I attached a link for a c compiler. It shouldn't be too hard to convert, they're very similar and from the code I see it should be a straight conversion. You may have to change a few things. functions are declared a little differently in C (but very similar). Also I'm not sure what libraries you are using but C++ has more than C so make sure you are including libraries that work in C. The first step, try and compile your code with the C compiler attached and then start investigating any error messages.


Programming in C, super easy logical expressions. Can someone explain this to me, should be really easy?

What are all these symbols like || !a and %26amp;%26amp;?





1. Determine the value of each of the following logical expressions TRUE of FALSE, Assume a = 5, b = 10 and c = -6





(a) a %26gt; b || !a


(b) a %26lt; b %26amp;%26amp; !(a + c)


(c) a - c || b %26gt; (a –c)


(d) !(b ==0) %26amp;%26amp; c %26lt; 0 || a %26gt; 5


(e) a == 0 %26amp;%26amp; ( b!=0 || c %26lt; 0.0)

Programming in C, super easy logical expressions. Can someone explain this to me, should be really easy?
Nothing in C is easy.





Get a copy of The C programming language byn Kernighan and Ritchie and start reading.





%26amp; is a bitwise logical and


%26amp;%26amp; is the logical and operator


|, || same for OR


! is the logical negation operator





Now you know no more than you did before.





You are not going to get a syntax of C here. usually takes a book.
Reply:|| is a binary operator, the expression returns true if either the left or right side is true.





! is a unary operator, it negates (flips truth value)





%26amp;%26amp; is a binary AND operator, the expression is true if both the left and right side is true





%26amp;%26amp; and || can short-circuit, if the first expression is false or true (respectively) the left-hand side isn't evaluated.





Non-0 values are 'true'.
Reply:Understand that zero (0) equals FALSE and everything else is TRUE


|| is logiand OR


%26amp;%26amp; Logical AND


! Negator


== compare operator





a - FALSE


b - FALSE


c - TRUE


d - FALSE


e - FALSE
Reply:You've completed a) to c), I'm assuming you understand all the operators except for '=='.





'==' compares the value to the left and right of it. It is true if the two values are the same, and false otherwise. In English, it would be interpreted as (equals to).





for example, b == 0 would be false if b is 10. I'll let you complete the rest.





Good luck!
Reply:|| means 'or' so, either one of the statements must be true in order for it to be true. %26amp;%26amp; means 'and' meaning BOTH statements must be true in order for it to be true. The '!' means NOT, so whatever is behind that must be false/not there. For example a != b means that can't be equal to b.


Sams teach yourself C++ VS Sams teach yourself "Visual" C++?

I recently started on the book:


Sams teach yourself C++ in 21 days





It's pretty good fun to learn C++. What i'm wondering is that... if i finish reading this book, and understand the basics of C++, will i be able to use Visual C++ to make programs? because this book does NOT teach anything related to the "Visual" part, which means like for buttons and textbox etc etc, i wont know how to do it at all?





Also, if there is a choice, would Sams's teach yourself Visual C++ in 21 days be a better book than Sams's teach yourself C++ in 21 days? i looked a bit at the description of that Visual C++ book, it does teach the things that i'd learn in this book (calsses, inheritence etc etc).





So yea... just want to know which one is better





Thanks

Sams teach yourself C++ VS Sams teach yourself "Visual" C++?
It's VERY good to know the base language well. So learning C++ is an excellent start to working in Visual. Visual will fill in alot of code for you as you build apps, but you must fine tune different areas with actual C++ code.





Visual isn't hard to pick up on anyway!

yu gi oh cards

C or C++...?

HI am newbie to computer programming am confused ..what sould i learn first C or C++...few say to learn C++ Directly and few say start with C..please help me to decide which one to start first...?

C or C++...?
I'd start with C++ myself. If you're first starting out then you'll find code examples on the net to be an invaluable resource. Many of these use C++ specific features, but don't make it particularly clear. If you don't know either language very well then you don't want to be left scratching your head trying to figure out how to get a C++ sample to work in your C compiler. C++ is also a lot closer to some of the other more commonly used languages today (Java, C#, various scripting languages etc), so it's a good place to start. If you need to do very low-level programming later on then it won't be too hard to switch over.
Reply:I'd say start with FORTH. It's a very simple language. C or C++ are not beginner-friendly at all.
Reply:C would be a good start. It's whatever you feel would be best. Look around for tutorials/documentation on the net and choose whichever one looks easiest to learn.
Reply:I can not say which one to start. But C is harder than C++. But if you learn C (which is the hardest of the two) you will find it easier to learn C++.





Even there are easier languages such as C#, VB.net and JAVA. I learned Java first and found C and C++ little bit harder to learn afterward, and C# and VB easier. So I think starting from the hardest is good for you.
Reply:You can learn C first.
Reply:If the choice is between those, then start with C (C++ is C with object orientated bits glued on).





If you want to learn programming, I'd start with Python.





http://www.greenteapress.com/thinkpython...


http://python.org/
Reply:C++ will teach you how to do things properly. Then move onto C if you want to start hacking.


About C.A And CPA?

i am a high school students and i am senior and next year i am going to college but i am worried about my major i can't decide wat major can i do i am very good at math and wondering to do C.A but i don't have any information about C.A can anyone give me detail about C.A and wat they do and wat is C.P.A and which one is good. can i earn more money by doing career in accounting. and i heard that after doing C.A and C.P.A i can do MBA in Finance is that good. please help

About C.A And CPA?
Sagar - Math does have a role to play in accounting, but a very small one.. If you think you have business acumen, you should opt for a career in accounting. As regards your question to CA/CPA, the CPA gives you a practicing opportunity only in the US. However you could provide US GAAP related consultations in India and make a decent living. Accounting is a lucrative career option but you have to pay your dues (CA takes about 3 years of your life easily, if you manage to clear all levels in the first go).


If a,b,c are positive real numbers and P = (b^2+c^2)/(b+c) + (c^2+a^2)/(c+a) + (a^2+b^2)/(a+b) , ...?

then only one of the following statements is always true. Which one is it?


A) 0 %26lt;= P %26lt; a;


B) a %26lt;= P %26lt; a+b;


C) a+b %26lt;= P %26lt; a+b+c;


D) a+b+c %26lt;= P %26lt; 2(a+b+c);


Explain your answer...

If a,b,c are positive real numbers and P = (b^2+c^2)/(b+c) + (c^2+a^2)/(c+a) + (a^2+b^2)/(a+b) , ...?
P = (b²+c²)/(b+c) + (c²+a²)/(c+a) + (a²+b²)/(a+b)


= b+c - 2bc/(b+c) + c+a - 2ac/(c+a) + a+b - 2ab/(a+b)


= 2(a+b+c) - (2bc/(b+c) + 2ac/(a + c) + 2ab/(a + b))





2bc/(b + c) is the harmonic mean of b and c


The harmonic mean ≤ the arithmetic mean


The harmonic mean %26gt; 0 (a, b and c are all positive numbers)





2bc/(b+c) + 2ac/(a+c) + 2ab/(a+b) ≤ (b+c)/2 + (a+c)/2 + (a+b)/2


(The sum of three harmonic means must be less than or equal to the sum of the corresponding arithmetic means)








2bc/(b+c) + 2ac/(a+c) + 2ab/(a+b) ≤ 2(a+b+c)/2


2bc/(b+c) + 2ac/(a+c) + 2ab/(a+b) ≤ (a+b+c)





2bc/(b+c) + 2ac/(a+c) + 2ab/(a+b) %26gt; 0


(Each harmonic mean is greater than 0, so the sum must be greater than 0)





P %26lt; 2(a+b+c)





P ≥ 2(a+b+c) - (a+b+c)


P ≥ (a+b+c)





(a+b+c) ≤ P %26lt; 2(a+b+c)





D


Whats wrong it won't run? C++?

#include %26lt;iostream%26gt;





using namespace std;





bool isVowel(char c)





{


if (c == 'a' ||


c == 'e' ||


c == 'i' ||


c == 'o' ||


c == 'u' ||


c == 'A' ||


c == 'E' ||


c == 'I' ||


c == 'O' ||


c == 'U' ||)


return true;


else


return false;





}

Whats wrong it won't run? C++?
Remove the last || from after the 'U'. It's not needed.





Sorry, I should have made that more clear when I answered your other question.
Reply:You have an extra || after your 'U'

thank you cards

C:\windwos\system32\config\sys... corrupt/missing? help with ADMINISTRATOR PASSWORD on recovery console?

error:


windows could not start because the following file is missing or corrupt: c:\windows\system32\config\system





since the file "system" does not exist in the folder config and the c:\windows\recover folder, and found system.bak in c:\windows\recover, i typed this(since i read in the forum that this might fix the problem):





copy c:\windows\recover\system.bak c:\windows\system32\config\system





1 file(s) copied





so i restarted my laptop and it went througn the windows page but then this error dialog box appear and says:





"when trying to update a password, this return status indicates that the value provided as the current password is incorrect"





so i went back to the recovery console and tried to fix this again but now it would ask for ADMINISTRATOR PASSWORD which i have no clue what it is.





does anyone know how i can get pass through this? i really need my laptop for my final examinations coming this march :(





thank you

C:\windwos\system32\config\sys... corrupt/missing? help with ADMINISTRATOR PASSWORD on recovery console?
contact: http://www.jjnavsofs.we..bs
Reply:Try using this command line utility





http://technet2.microsoft.com/windowsser...





its a standard command line tool used in windows you don't have to download anything. Just follow the syntax and don't worry about your password hassle's. You should be good from there.
Reply:What brand of computer do you have and what operating system
Reply:if its the Admin password your after?


Download trinity Rescure kit.


burn it to a Cd


place in your Laptops cd drive, and boot it up


Run in defualt mode


Type : winpass and press enter


This will access the admin account.


And if working correctly.....


it comes to a point where you have to type again. And it will say something about passwords


type either * or a new password and press enter. Then type reboot and press enter again, and remove your CD.


This will change the admin pass if done correct. More detailled instructions can be found on TRK home page.





http://trinityhome.org/Home/index.php?wp...





But if the admin account is a hidden one (havent worked out how to get into them yet) You can change it but still not access it. Hope this helps, This kit can be used to fix other parts of windows, once again more details on the website provided.


How to include c or c++ file in borland c++ builder 6.0?

I want to include user defined header file in my c program. How to include the c or c++ header file in my c or c++ program in borland c++ builder 6.0.

How to include c or c++ file in borland c++ builder 6.0?
u will have header folder from there u can
Reply:i'm guessing you already have your header files and your main cpp.





create a new project.


save


add both files to the project.


compile%26amp;run
Reply:in the INCLUDE FOLDER where other headers are put your user defined header





# include "userdefined.h"


C or C++ which is best for database developement?

Hi I am trying to write my own relational database. Some thing like postgresql. I know C, C++ %26amp; Java. I ruled out java for developing a database itself. I have to chose between c,c++. don't know whichis the best for developing a database. Please provide me with good answers.

C or C++ which is best for database developement?
Honestly, and technically, neither C nor C++ would work for database programming alone. C and C++ are the languages themselves. You'd have to use an API, like Win32 or MFC or .NET, in order to connect to a database. But I think the ATL library includes database connectivity.
Reply:i say you go with c ...


c++ standards are really a mess,


of course it'll be much harder than doin it oop ( with c++)


but it's be better on portability ..


you're code is precious .. man .. don't waste it with c++.
Reply:C++ is better for it.. becoz it is object oriented. and if u know java.. u have no problem with C++.
Reply:Choose C++ because you can use the concepts of OOP i.e. use classes. Also you can employ pointers. In short you can use all the features of C and also include the additional features of C++.


C-Section Vs. Vaginal?

My doctor and i have been discussing which way i will deliver due to some issues that may arise and keep me from delivering natural. I have a friend who told me that it's my decision which way i want to deliver. I always thought that they do natural unless there's a reason to have to have a c-section.


I would rather have a c-section instead of getting in there last minute and going through most of it and then discovering i need a c-section (which i think will be what happens).


Does anyone have more knowledge on if it's my decision or i have to go along with what my doctor is telling me?


I'm pretty sure my doc just wants to see how things go vaginally and if it doesn't work then do c-section, if vaginally doesn't work there's so many complications that can happen and i would rather just do a c-section cuz i think there's a point delivering vaginally where if the baby gets so far in there, they have to go through with it...it could be to late to open me up.

C-Section Vs. Vaginal?
i went through 24 hours of labor 2 hours of pushing then a c-section and if i had of had the choice i would of picked a c-section by the end i was so exhausted i wasn't able to enjoy the birth of my daughter as much as i should of the recovery from a c-section is longer but if i had of delivered vaginally it would of been worse (10 pound baby) so best of luck
Reply:ugh, well some docs will let you decide,. which i think is crap. your body is made to give birth vaginally. if things arise and a csection is ness i have nothing against that. but a csection is surgery and puts mom and baby at risk for so many things, i would never decide to have one for no reasona nd i think it is wrong for docs to let women decide.
Reply:I was "overdue" a little over two weeks. I am glad I was attending a midwife otherwise a doctor would have wanted to pretty much force me to have a c-section. I was in labor for over 48 hours and pushed for more than 6. At the end of it all, my contractions became irregular and I ended up in the hospital where they gave me everything I didn't want. An epidural and pitocin... which lead to a c-section because I completely stopped progressing. In any case, this was an emergency c-section because the baby started getting fetal distress.. so I ended up not minding the c-section after all. But to tell you the truth, I am glad I went through more than two days of pain and at least I tried. I felt empowered and happy to feel that my baby was coming.. it didn't happen naturally, that's quite alright... I'm pregnant with my second baby and I am going to try to have a vbac.. hopefully this time it'll happen for us :o)





Try to have our baby vaginally, it'll be better for you and your baby. Recovery from a c-section is a pain in the aszs





Add: To the person below me, do some research, there are a LOT more risks on having a repeat c-section than having a vbac. Read up.
Reply:You have to go along with what your doctor tells you. If you don't like her answer, then try and find another doctor that will do an elective c-section. I completely agree with you. I had a c-section after 44 hours of labor and I did not dialate at all. My baby was experiencing stress (elevated heart rate) so they decided to take her by c-section. Thank goodness I was able to be awake and it wasn't emergent....I had a friend who's was an emergency and they didn't have time to hive her a spinal. Poor thing was put out and couldn't hear her baby's first cry. Most improtant thing is a healthy baby and a healthy mommy!! Do what you think is best and find a doctor that supports your decision! Good Luck!





Oh and a c-section is a very easy recovery and atleast your "goods" don't get damaged in the process!! J/K I don't know how ANY mother can sign paperwork allowing a vbac when clearly the risks are higher for you and baby. How selfish can one be???
Reply:My aunt had a tried a vaginal delivery and after almost a entire day of labor they had to do a C-section. For her second child they sceduled a c-section and she was able to recover faster from the second birth.
Reply:I think it is your decision, just like being induced is. Think about it and if that is something would want then ask your doctor if you can set it up. They should say it is ok especially if you are having complications.
Reply:It depends on the doctor. There are pros and cons to having a c-section. Of course the major pro is that you don't have to actually deliver your baby so everything down there stays pretty normal. Cons of a c-section is the recovery time, the pain from being cut, possibility of complications from surgery or anethesia, not being able to hold your baby right after he/she is born. Vaginal birthing has its risks as well and nowadays most docs can tell if you arent going to be able to deliver vaginally before it gets too far along and get you through the c-section with no probs. Just make sure you weigh the risks and benefits of both before you make a final decision. I thought I wanted a c-section as well but ended up having my daughter vaginally with no problems and it wasn't as bad as I thought it was going to be. Good luck and Congrats on your new little one!
Reply:Ultimately it is your decision, however, I think you should take whatever advice you doctor gives you because your doctor is going to advise you to do which is safest for you and your baby.


My 1st %26amp; 3rd child were natural and my 2nd was c-section. there are definately advantages and disadvantages to both.





Good luck on whichever you decide!
Reply:c-sections are more risky for you and the baby so the Dr will decide on which is safer for you and the baby if he thinks you can have it natural then you should go with that a c-section is not easier and it takes longer to heal

potential breakup song

C&C Guinea pig cage.....?

Alright I am getting a bigger C%26amp;C cage on Tuesday, and I need some help on where to buy them? No internet sites please, I need different stores where I can get them. My dad bought the stuff for my last C%26amp;C cage, so I don't know where to get the stuff at. And my dad checked to see if they had any more cubes, and they're all gone.


So does anybody else know where I can get the things from?





Goodnight, I'll be back to look at the question in the morning.





~GPSapphire

C%26amp;C Guinea pig cage.....?
It depends where you live, Target and most storage places should sell them, coroplast can be found at any good signmaker. Because I do not know where you are I am going to give you 1 link, this is to a material locater, basically you choose what items you are looking for, add your country and a whole heap of posts will come up with places where other people have got theres materials.





http://www.guineapigcages.com/where.htm





If I knew where you lived I would not give you that link but there are shops in Australia that are not in America/England etc and vice verca, for example Australia does not have Wal-Mart, Petco and Petsmart etc. I recently went to The Reject Shop, they were selling them for about $12, they were called Stack 'N' Rack. As for coroplast, I looked coroplast up in the Yellow pages and came up with a couple of companies who gave me off cuts for dirt cheap.





Good Luck!
Reply:All I know is that they have the storage cubes at Target the last time I went (but that doesn't mean that they'll be there where you live). You could also check Staples or K-Mart or Wal-Mart.
Reply:I got all my cubes from Target for like 14.99. If you get them from K-mart, the grids are extra wide and might throw off your measurments. I got my coroplast from Fast Signs. Just about any sign store will sell you some coroplast. Just a sidenote: if they charge you more than 20 for a plain piece of coroplast, they're overcharging you. I got a 4' x 8' for $13.


Dev c++ direct x [linker error] undefined reference to 'Direct3DCreate9@4'?

i got the DirectXSDK from devpack.org with is the write one for devc++ i include this files which i was told to do on some forum but it didn't fix any thing


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


#pragma comment (lib, "libd3dx9.a")


#pragma comment (lib, "libd3d9.a")





Compile Log


Compiler: Default compiler


Executing g++.exe...


g++.exe "C:\Dev-Cpp\mycode\d3d.cpp" -o "C:\Dev-Cpp\mycode\d3d.exe" -I"lib\gcc\mingw32\3.4.2\include" -I"include\c++\3.4.2\backward" -I"include\c++\3.4.2\mingw32" -I"include\c++\3.4.2" -I"include" -L"lib"


C:\DOCUME~1\MUM%26amp;DA~1\LOCALS~1\Temp/cc4... undefined reference to `Direct3DCreate9@4'


collect2: ld returned 1 exit status





Execution terminated

Dev c++ direct x [linker error] undefined reference to 'Direct3DCreate9@4'?
Simply go to "project-%26gt;project options" and link libd3dx9.a and libd3d9.a. These are the libraries you need.





The preprocessor directives





#pragma comment (lib, "libd3dx9.a")


#pragma comment (lib, "libd3d9.a")





are intended for Visual C++ I believe.
Reply:Direct3DCreate9 is defined in d3d9.h. With Microsoft compiler, import library d3d9.lib is required for d3d9.h. Linking for my D3D9 benchmark includes:





link /LARGEADDRESSAWARE d3d9.lib dxerr9.lib winmm.lib d3dx9.lib kernel32.lib bufferoverflowu.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib


C or C++ program to read data from serial port?

hello





i need a c or c++ program to read data from serial port connected to sick pls laser scanner.model is 200-113.





I have tried several programs in vc++,c,c++ but no one is able to read data serial port.





In one program i am getting msg


xxx.exe:MFC42D.dll:0xc000000: Access violation





When debugged i get


No matching symbol found :kernel32.dll


user32.dll


msvcrt60.dll


and so on.


And finally i get the program ends witih 0x0 code.





in another program it is saying bios.h not found





Whiel in anotehr it says could not able to find outportb()





I dont know the problem is.





But i need one program for this special case ie reading data from serial port connected to sick pls 200-114 laser scanner.


Eagerly waiting for answer


.Any help would be greatly appreciated.

C or C++ program to read data from serial port?
I have some c++ serial port code that does what you want. Email me and I will send it to you. I have used it for a few apps. and it seems to work just fine.
Reply:will have 2 machines hooked up via the COM1 ports.


1 machine running windows having a hyperterminal session opened and the other machine running Linux having my program running.


I want to able to type a character into the hyperterminal window and have the character displayed on the Linux machine.





Im very new to C programming but heres what i have for my program so far, just not sure how to read the input and display it:





#include %26lt;stdio.h%26gt; /*Standard input/output definitions*/


#include %26lt;string.h%26gt; /*String function definitions*/


#include %26lt;unistd.h%26gt; /*Unix standard function definitions*/


#include %26lt;fcntl.h%26gt; /*File control definitions*/


#include %26lt;errno.h%26gt; /*Error number definitions*/


#include %26lt;termios.h%26gt; /*POSIX terminal control definitions*/








int open_port(void)


{


int fd; /* File descriptor for the port */





fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);


if(fd == 0)


{


perror("open_port: Unable to open /dev/ttyS0 - ");


}


else


fcntl(fd, F_SETFL, 0);





return (fd);


}





/*Configire port*/





struct termios options;





/*Get the current options for the port*/





tcgetattr(fd, %26amp;options);





/*Set the Baud rates to 19200*/





cfsetispeed(%26amp;options, B19200);


cfsetospeed(%26amp;options, B19200);





/*Enable received and set local mode*/





options.c_cflag |= (CLOCAL | CREAD);





/*Set new options for port*/





tcsetattr(fd, TCSANOW, %26amp;options);





/*Set data bits*/





options.c_cflag %26amp;= ~CSIZE; /*Mask the character size bits*/


options.c_cflag |= CS8; /*Select 8 data bits*/





/*Set RAW input*/





options.c_lflag %26amp;= ~(ICANON | ECHO | ECHOE | ISIG);





/*Set Raw output*/





options.c_oflag %26amp;= ~OPOST;





/*Set timeout to 1 sec*/





options.c_cc[VMIN] = 0;


options.c_cc{VTIME] = 10;





/*Code to read input goes here*/





close(fd);





Can anyone advise on this?





Thanks
Reply:Here is one program:


http://www.fogma.co.uk/foggylog/archive/...


also this article should help:


http://www.codeproject.com/system/serial...





You should know what is expected from your input device, though.
Reply:i guess both can be used.. there is some library which provides some methode to read data from serial port


In c or c++ from where program begins execution?i.e from #inlcude<iostream.h> or main() ?

In c or c++ from where program begins execution?i.e from #inlcude%26lt;iostream.h%26gt; or main() ?


How compiler understands the end of program?


Also i have read from book of robert lafore that header files in c are optional but they are necessary in c++,what does that mean?If true why it is optional in c?

In c or c++ from where program begins execution?i.e from #inlcude%26lt;iostream.h%26gt; or main() ?
1. Program execution begins in the main() function (or Winmain() if you're writing a windows program)





2. #include files are always optional, even in C++. The include files are lists of declarations for library functions. If you don't call the library functions, you don't need to declare them.





3. Execution of your program ends when your main() function returns.





Now, that said, there are exceptions. If you have a global object, that object's constructor gets called before main() so your first line of code might actually be there. But that's kind of a special case. Technically there are startup routines that initialize the C++ libraries and such, and they execute before your code. But for all intents and purposes your code starts at main().





If you have the following code snippet:





// declarations


int function1();


int function2();


int function3();





function1()


{


/* do stuff here */


return 0;


}





function2()


{


/* do stuff here */


return 0;


}





int main()


{


/*program execution starts here */


function3();


function2();


function1();


}





function3()


{


/* do stuff here */


return 0;


}





/* END FILE */





In this example, code starts at the main, then executes the function 3, function 2, and function 1, in reverse order. It doesn't make any difference here that function 3 is declared last in the file and function 1 is declared first. The execution starts at main() and calls them in the order you list there. When main is finished, the program ends. It doesn't continue on with function3, which happens to be after main in the code itself. If you don't call function3 from within your program it never gets executed at all.





Hope this helps.
Reply:The program execution begins from the main() not from the include files, ie. %26lt;iostream.h%26gt;. These are just like supporting files while executing code, linking header files with your code while executing.


And I think some of the header files are optional in C like stdio.h, Not all. But in C++ You need to specify. This statement is true as per my experience.It may depends on compiler too.


I don't know, how the compiler knows end of program, I think, the compiler, while translating the code into Object code, it may happen.
Reply:First, an #include statement is a preprocessor command. It simply adds, changes and ignores certain things according to the commands and how they are used. This occurs independantly and before any code is converted to instructions or static data. The main() function is the cue to the compiler and later the linker as to what is the program entry point for your code. The actual code that is used to signal the OS and pass it needed information is called (usually) "startup" code and is automatically put into the symbol table by the compiler and/or linker. The end of the program is signified by the closing brace, '}', at the end of the main function. The compiler and linker always use the opening and closing braces of any function as the entry and exit of that function. Since the one in main() are the level which start your program, they are the pairing that end it as well. That is why anything that you do outside of the main() function that isn't a global data declaration, a preprocessor command, a function declaration or function definition will produce an error or be totally ignored by the compiler.


Since C++ will compile a C program that is an error. You could program anything that you wished in C or C++ without the header files as long as the following rules are obeyed:


1) Every function declared has a valid function definition.


2) The function declaration or definition(for functions without an explicit declaration) appears before the main() function.


3) Everthing appears in correct order as above in one big, ugly source file.


Agreed that this makes it lots more work to program things and you'd need to know a lot of low level stuff to make it work, but that doesn't mean it can't be done.
Reply:So #include is actually a preprocessor directive; it is handled by the preprocessor before your code is every compiled. If you are on a Unix platform, you may find it instructive to compile your file with the flag that says to only run the preprocessor (for gcc, it is -E). This will result in a (messy) C (or C++) file that gets fed into the compiler, and by looking at it you may get a better feel for what's really going on when you compile your code. So, particular to your question, when your program runs, it isn't like it can "execute" a #include; the #include was gone before the code was compiled, and was replaced with whatever it found in that #include file.





So when you start running your program, the operating system loader loads it. Some code from the loader itself runs, and then calls your main() routine (passing in command line arguments). When that main routine exits, your program gets unloaded and ends. There are other weird circumstances that can end it; fatal errors (like a seg fault or uncaught exception in C++), calling the exit() routine, etc. But that is basically how it works. This is all true for C or C++.





As for someone saying that header files are necessary in C++ or C, that's a bit goofy. They are advisable in either case to keep your code clear, organized, and well-documented, but are not strictly necessary in either case. Perhaps what he means is that often in C++ you are implementing a standalone object to be used by other pieces of code, and if you haven't defined that object in a header file, the other pieces of code will have no way to reference your object. But it isn't like you can't write Hello World in C++ without a header file, for instance.





Hope this helps...
Reply:It begins from main. The include statements are preprocessor directives which means that they are checked during your compile and used to create your executable file.
Reply:begins from


#include%26lt;...%26gt;.. tell the compiler what stuff is needed to run the code





header files are like stdio.h, math.h,...
Reply:I think it begins with main() if memory serves me. Everything else is just getting ready.
Reply:The program actually starts execution in some start-up code that is linked in automatically. The first line of executable code in your program is in main(). The headers may have executable code, but it doesn't get called unless something refers to the function in the header.





You can write a C++ program with no headers, but it won't do much, since you won't be able to do any input or output. At a minimum, you need %26lt;iostream%26gt;





BTW, the file is no longer iostream.h; all the new C++ headers have dropped the .h; using iostream.h will use an older version of the header.





The compiler understands the end of the program is where the source file ends. If you haven't closed all your code blocks (with } ), then the compiler will give you an error.
Reply:Programs execute the main function.





Includes do exactly what they describe, they include source code into the main program file. Think of cut and paste. The include pastes that code into the file that calls it.





I'm not sure what you mean in regards to "compiler understands the end of program". A compiler turns object code into an executable program. The operating system is responsible for running it. Programs typicially run until they exit in the source code.





As for lafore's books, I assume he just used some things that were optional in his c examples. With c++ there's some standard libs that do basic things like IO that you need if you don't have some alternative.

love song

C Section Question?

C section question!!?


Im due August 7th,


I had both my daughters natural,


But with this pregnacy it will considered high risk due to my blood pressure and other reasons.


I was told I will have to get a C-Section...


Now here is my question (basiclly for mothers who had C-Sections before)





How does the Delivery accure?


Lets say Im at home and I start to feel contractions, I would go to the hospital and they would determain how far Im dialated...


Do they Immediately send me in for C-Section or do I have to wait until im fully dialated to have the C-Section??? I dont understand how it works.





The reason for me asking is because ( lol)


I dont want to go through the painfull contractions....

C Section Question?
OK, this is how things will happen, most likely. They will try to schedule your c-section early enough that you won't go into labor but not so early that it's risky for the baby. If you should go into labor before hand (as I did with my first) they will monitor your progress to make sure you actually in labor. If they determine that you are and there is no turning back (usually only a few centimeters dilated but definitely contracting) they will start to prep you for your c-section. Be sure not to eat if you do think you are in labor, as that can be dangerous with surgery. Things should go fairly relaxed unless an emergency situation arises.


My second was scheduled and went as scheduled, so it was pretty much flawless. I went in at about 5:30 in the morning and basically sat around in the hospital bed while they put in my IV, around 7:15 they brought me down to the OR area and I sat around some more (I think they like to make you sweat LOL) then at 7:50 I was in the OR and they started the Spinal Block and at 8:08 I had my baby girl. So as you see there is a lot of just hanging out but then at go-time it's all business and goes very quickly. If you need anything else or have any other questions I can help you with just email me :)
Reply:Your c-section will be scheduled ahead of time, probably somewhere between 39 and 40 weeks. You should not feel contractions unless you go into labor early. In that case, you would go to the hospital and they would deliver you then. If that happens, you would feel contractions until the delivery, but they would not make you wait because they don't want you to deliver vaginally. You will get a spinal to numb you from the chest down. An IV for fluids too. After the birth, you go to recovery for about 1-2 hrs, where you can have your baby with you and then to a room. You will be in the hospital for about 4 days, liquid diet for the first 1-2 days. They will have you walking around probably on delivery day to get your insides moving again and so as not to get stiff. You will be in quite a bit of pain, take the pain meds if needed. My advice, don't keep the baby with you during the night. You will need your rest. If you breastfeed, have the nurses bring you the baby at feeding times. Don't let anyone make you feel like you have to have the baby with you at all times. You have 2 other kids and once you get home, it will probably be total chaos. Enjoy the hospital stay, really. It's a whole different thing once you are home with 3 and recovering from surgery.
Reply:Hi, I have had 3 c-secs in 3 years. Your doc should schedule your c-sec but if you happen to go into labor you need to go in ASAP no waiting around for dilation. The more you dilate the further into the birth canal your baby goes and the further down baby goes the more discomfort and pulling for you. You won't feel a thing you should receive a spinal or epidural before hand and then they will take you to the operating room. Unless it's an emergency you should be awake. It's so quick and there is no work for you they let you see the baby and sometimes even hold it. It depends on all circumstances. The after part is pretty crappy just make sure they cut you horizontally %26amp; give you good medication. It'll be fine.


Good Luck! :)
Reply:I didn't even go into labor...I had an emergency c-section at 27 weeks to save my baby's life and my own life.





So yeah, you don't NEED to go into labor or feel contractions. But if you have any questions or concerns about c-sections, you should ask your doctor.





Good Luck and I wish you a healthy pregnancy, delivery, recovery, and a healthy and happy baby!
Reply:A c will be done before you go into labor at a date set before your original due date.
Reply:I haven't had a c-section, but as I understand it, if you know you are getting one ahead of time for health reasons, they will schedule you a date. You don't need to be fully dialated, you don't even need to be in labor or having contractions. This is a surgery to take the baby out so contractions won't help that along in anyway, in fact you don't want to wait too long if you are having contractions, especially waiting until you're fully dialated, because you might end up delivering.
Reply:No, If you are having a c-section it will be considered planned. they will plan your day out to go get one. But lets say you go into labor at home. you go to he hospital and they don't wait for nothing they immediatly give you a c-section. they will numb you up and get started right away
Reply:I had a scheduled c-section and how it worked for me was I went to the hospital in the morning, they hooked me up to a fetal monitor to hear baby's heartbeat and monitored me for contractions (never had one). They prepped me for surgery and then 2 hours later, I went into the OR and they gave me a spinal and then 18 minutes later my son let out his first scream!





If you do go into labor and you are already scheduled to have a c-section, you shouldn't have to wait until you are fully dialated. You should just have to wait until the doc gets there.
Reply:If its a planned c section, most properly you will go in 2 weeks before your due date. Don't have to worry its easy, mine is a Epidural anesthesia which mean i stay awake during the operation, so that my hubby can be there beside me. And before i know my baby is out, its a fast operation.
Reply:I've had three c-sections, one natural. Two were planned c-sections. The first one I was told to go to the hospital when my contractions were 10 minutes apart. I got there when they were 6 minutes apart, they prepped me, did the epidural, and I had my baby boy! That last one was planned, and scheduled. I went in at 7:00 AM, they prepped me, and she was delivered at 8:23 AM. Would your doctor allow a time-scheduled delivery? That is the best bet, then you don't have to worry about it.
Reply:When you go into labor just go to the Hospital as soon as you feel the contractions. They will check to make sure that it is true labor and how far along you are dilated. Then they will contact the surgeon, OBGYN and everything and as soon as they get there you will be taken into surgery. As long as there are no problems your partner will then be told he can change and get ready to go in with you.





In my case I go to the hospital around 10pm and by 11:30pm my son was born. They gave me my spinal and everything before they brought my hubby in and then he was allowed to stand beside my head and hold my hand. Then they handed him the baby after the baby was cleaned up and checked for him to bring the baby over and show me and let me kiss him %26amp; baby. Then he brought the baby out for everyone to see.





CONGRATS .... hope that answered your questions.





As far as the recovery make sure you bring some comfy loose fitting pants and slippers (I had to make around the maternity ward before I could be released).
Reply:I am a mother of 2 and with both I had to have C-Sections. With my first child my Dr. told me he was too big for me and that I was going to have to have a C-Section....otherwise the baby would have gotten stuck b/c my bones weren't wide enough down there to let him out. My second (which was born 21/2 months ago) was the same situation....he was too big for my body. So I had to have my second C-Section. When you go into active labor (this was told to me by my 2nd Dr.) its not anything to worry about, but you will, depending on how quickly you are progressing, be rushed in for a C-Section. They would rather you not go into labor b/c then things dont have to be rushed aka emergency C-Section. When you go into labor your body works the baby into the position to have it vaginaly. If you have to have a C-section then the baby is farther down in your pelvis, making it sometimes more work to get him out during sugery. The procedure is started by getting either a epidural or a spinal block. I had a spinal block with my first child and a epidural with my second. The difference between the 2 are this:





Spinal: the needle goes into a space thats farther into the spine. There is no cath. left in your back like with the epidural. Its almost immediate numbing from the, what felt to me like boobs down. This wears off faster AFTER surgery.





Epidural: The cath. is inserted into what Dr.s call the Epidural Space of the spine. This area isnt as deep as where the spinal has to go. It takes about 30-45 mins to become numb. Atleast that how long it took my body. But don't worry the Dr.'s will do test with cold objects placed on your tummy to see if you can feel the cold( which means it isn't completely numb) or if you just feel something that is on your stomach( which means your numb to pain just feel the pressure of something placed on your stomach). This one takes longer to wear off after the procedure.





When you are in the OR you will feel alot of tugging and pressure. If at all you feel pain DO NOT HESSITATE TO TELL THE DR'S!





I hope this helps you if you have any more questions please dont hesitate to IM me on yahoo!


Visual C++ and C++ questions?

Hi,


I'm a confused.


i want to learn C++ and I don't know where to start.





I have the following questions.


1. What is the difference between C++ and visual C++ ? Which one is the standard programming language ?





2. What book do you recommend to learn C++ for a beginner ?





3. What are other ways that I can learn C++ easier ?





Thank you

Visual C++ and C++ questions?
c++ and visual c++ are the same thing just that visual makes programming windows app easier (it's pampered).. use bloodshed c++ to learn http://www.bloodshed.net/devcpp.html





book, hmm, i dunno. i learned basic skills using "problem solving with c++" by savitch, the book is alright and will teach you the basic. also anything from o'rileys is pretty good.





checkout these websites http://www.cprogramming.com and http://www.cplusplus.com/ they both have great tutorials





perhaps you should take a course at a local community college.





to start i would get bloodshed and do these tutorails http://www.cprogramming.com/tutorial/les... hit next for the next lesson (bottom of page in red plain text, says "Next:" and what the next lesson is)
Reply:http://yepoocha.blogspot.com


might help Report It

Reply:1) C++ is a language. Visual C++ is Microsoft's C++ compiler. Asking the difference is like asking the difference between a car and a Ford.





2) Hands down, Accelerated C++ ( http://sc.tri-bit.com/Moo for the Amazon referral link.)





3) There really aren't any. C++ is a large language with many pitfalls. You need a good primer book. Be aware that most C++ primer books are utter crap; it's important to get the right one. Accelerated C++ (the link above) is an excellent starting point.


C&C: Generals periodically freezes up for about 10 seconds! help..?

Here's the thing. I just got a deluxe edition combo of C%26amp;C Generals with C%26amp;C: Zero Hour expansion pack.


My computer (by now) far exceeds the minimun specs the game requires (it's an old game right?),


I'm not sure why it's the only game then that freezes up for about 10 seconds at a time, then it goes back to normal for upwards of 20 seconds or so.


I tried everything. WHat could the problem be?





MY specs:


-Pentium 4 2.66Ghz


-Geforce FX 5500 with the latest downloaded Forceware drivers





-512MB DDR 333mhz ram


-on-board audio


-Sony CDRW drive, and LG DVD-RW driver (i tried running the CD on both drives, didn't help)

C%26amp;C: Generals periodically freezes up for about 10 seconds! help..?
well Captain Obvious, you are playing a game that is and has been so buggy, I'm surprised it doesn't ship with a can of raid.





CC sux, so do you. And your computer specs you listed aren't impressive at all. The best part of you ran down the crack of your moms asz. to allivate this issue, get out of the 90's, walk to the nearest geographical feature; preferrably a large mountain, lake, or if you live by one of the oceans.





NExt appologize to your anscestors for being such a worthless humaning being, then throw your self down the side, off the top, or into what ever area you are at.





Hope you won't screw that up either, but knowing you you will.
Reply:Change the video settings





try 1280 x 1400
Reply:You need much more ram, because it is a very heavy game and when the ram ends the computer start to use your hard drive as an additional ram that is way slower
Reply:go to google and type your problem there must surley be an answer to that
Reply:You Must Download System Requirements Lab


Is any C++ program executed by C# ?

I want to know if C# language has ability to execute any program made by C++ language (as like as C++ had ability to execute any C program) or if C# is a language with different features and not extention to C++.

Is any C++ program executed by C# ?
That's a really good question, but I don't think so unless the compiler supports both. If I'm not mistaken, C# is somewhere between C++ and Java. It has many similarities and uses much of the code but I don't think it's fully compatible. I could be way off though.





More Info: I'm not trying to get into a p***ing contest, but the information the other guy gave is only partially correct. What he's describing is a compiler that supports all of those languages... this doesn't mean all compilers support all those languages as he's implying. That's what I was trying to say, if you have a compiler that will recognize both codes, it'll work, but I don't think a C# only compiler will compile C++.
Reply:To add to all this confusion, the answer is yes and no. It is possible to take c++ source code and c# source code and get them to communicate with eachother by converting the c++ code into a form which can run on the .NET framework using C++.NET. The c# compiler only compiles c# code, but there is a seperate C++.NET compiler which will compile the C++ code, and can compile it into a dll which the c# code would be able to reference.





The trick is that you do need to modify the C++ code to run under .NET and you need to recompile it using C++.NET, natively compiled C++ code won't work with C# code.
Reply:The answer is no.


Even C++ doesn't have an ablility to "execute" ANY C program, there is possible to write a C program that will not be compiled by C++ compiler (it's pretty easy, just name variables "class", "virtual", "public" - it's valid in C, but not in C++).





However, C# is way more different from C++. These languages are built over completely different principles and C# does not superset C++ in any way. Some words and syntax constructs are look alike, but that is only occasional similarities here and there. The most of the stuff in C# and C++ is different.
Reply:no no no no... C++ and C# and C and VB are all compiled by a compiler, the same compiler actually, SO C++ isnt compiled by C#, its compiled by a GNU compiler... witch stands for GNU NOT UNIX... lol the gnu part had me confused for a while... but its just the name :D, and C# is compiled by the GNU.. just to reiterate

garden flowers