Sunday, August 2, 2009

C++ or java please help?

as a programmer in a weather department, you are to prepare a report that shows the conversion of temperature from fahrenheit(f) to celsius (c) or from celsius(c) to kelvin(k). the formulas to convert from f to c to k are as followed:


c=5/9*(f-32):converts from f to c


k=c+273.15:converts cto k


if you are converting from f to c, the out put of the solution must display the temmperaturs in both f %26amp;c scales. likewise, if you are converting from c tok, the output of the solution must display the temperatures in both c and k scales





use code "f" for faherenheit,"c" for celsius, and "k" for kelvin





your input must include a code to indicate the temperature scale you are entering. your solution must be able tp perform five onversion events(loop) before it stops.





declare and use variables and include a heading expression"conversion" that must display as part of the solution





identify


the problems componets


write the loop test


write the decision test


draw the problems flowchart

C++ or java please help?
The best way to learn is to put some effort in your homework. If you show your work, we can help you where it's wrong. Simply doing your work for you doesn't help you learn and harms the people who do their own work.


Is your religion for you b/c you were born into it or...........?

because you studied, learned and now believe? I'm including athiests here too, b/c I want to know if you really studied all these religions and bibles only to come to your own godless conclusion.

Is your religion for you b/c you were born into it or...........?
i was born into a christian family but i made the decision for myself to be a christian, i looked at other religions and i realized that Jesus was the only way to God and i needed him so bad, i finally made the decision this summer at a youth conference
Reply:I was raised a Christian and it wasn't working for me. So, I'm currently agnostic. I've been trying to figure what does work for me, although I've been a bit lax in my studies lately.
Reply:I was basicly borned into one religion and than quit...started to read more of the bible and studied the religion i am now i also talked to many other people about it and many personal experiences... it just seems like a good thing for me now
Reply:I was born a Buddhist but never really a Buddhist until 15. After I learn it, I decide to follow the teachings.
Reply:Not born into religion.....
Reply:I believe in my faith because I believe in it with all my heart.
Reply:They're all lying. They were born into it and considered themselves Christians first. Than, they read what they wanted instead of the whole bible
Reply:i was raised to believe and fear god (not in an extreme kind of way) i started to question it in high school and I've been an atheist ever since. religion wasn't really prominent in my life ever. only used as a reason not to do things i.e. stealing is a sin. sinners go to hell
Reply:Studied and learned about it.
Reply:Studied, learned, believe. Not in any one religion, though. You can learn a lot by studying other cultures.
Reply:I wasnt born into my religion... study and personal experience has led me to where I am. (Christian-nondenom)
Reply:studied,read bible and was able to see the truth so i'm now a born again christian because of my belief in Jesus and what he done for me.
Reply:Personally I think most people chose the religion that is most convenient for them. It should be something that you study in depth and then take to your creator it prayer to find out if it is right or not.
Reply:I was born into it. Also, I studied many paths such as Islam and Hinduism, the Koran and the Upanishads, the Avesta and the Tao Te Ching and still I find fulfillment being Catholic. Yet one can learn greatly of the world around them. That is one thing I learned from Sufism: For the Love of God alone. Christ already had said so with the greatest commandment.
Reply:I was born into a religion, but found it to be false, so I did some research and learned from the Bible that the current religion I am with now is the true religion that is why I am with my current religion,because it is the only one that teaches the truth from the Bible and follows the truth by puting the truth into practice.Oh of course, I did look, into other religions, but only to find, they were no better than the one I was born into, and teaching many doctrines of lies which are not from the Bible at all but man's ideas
Reply:I was Catholic because I was raised that way and told to believe as such. When I got older, I challenged my faith and it lost. Now I'm an atheist.
Reply:I was born into Christianity, but that is not my religion now. I didn't have to study it to know that it wasn't right for me.
Reply:I studied, learn, and now believe. I was born into another religion (Christianity) that I began questioning objectively at about age 7.
Reply:I was born into Christianity. I have studied Buddhism, Hinduism and Sant Mat (Surat Shabda Yoga). I stayed with the last one as that made the most sense to me out of everything I practiced and studied. It contained answers to questions I'd asked all of my life and no one could answer.
Reply:anyone who studied, and then chose a religion is a bad studier. thats including athiests. theres no way to be sure of any religion being true based on stories told by other people. so im an agnostic... haha
Reply:I studied, learned, and believed. I am a born again Christian.
Reply:I studied several religions and came to my own conclusions.
Reply:I've seen miracles, that's why I believe. I'm a generic Christian after studying several denominations in great detail. I have studied other relgions to some degree but its hard to tell what part is the actual religion and what part is the culture that the religion came from.
Reply:my parents were confirmed luciferians i was baptized a luciferian. i am aslo a confirmed luciferian
Reply:My parents converted when I was one. I went along, I studdied, I took it seriously and studdied, I went to a Christian school and we were encouraged to study other religions I had a look I know abit about a few of them. I study evolution and Creation.





I almost walked out knowing the full truth of God, because of pain in my life, but God gently turned me around so the biggest thing that I am in my "religion" (i hate that word, I live a faith) is because of a true experience of God.
Reply:i have actually studied other religions before i became an athiest. i was raised a roman catholic but i choose not to believe in god

cvs

Can I include business expense deduction from 2007 to next year's tax filing?

In 2006, I paid registration fees and license fee for my side business - electronic shopping . I did not do Schedule C when I filed my TAX 2007 because the expense amount was just $700. If I file my tax next year 2008, can I still include the $700 as expenses on my Sched C?

Can I include business expense deduction from 2007 to next year's tax filing?
No, I believe you can only deduct them, the year that you paid them!


What is an A/C rapid charger?

Is this like a travel/car charger or a home charger? I ordered a phone off eBay that included the phone, battery, a/c rapid charger, and a bluetooth headset. I already have the manual.

What is an A/C rapid charger?
An A/C rapid charger is a 120 volt home charger that takes a couple of hours to charge the battery. Regular chargers can take 14-16 hours to charge.


Guys: What else should I put on his c.d.?

Alright so I'm making a c.d. for my crush because we are both really into music. But I'm not so sure what songs to put on there. Anything that has sweet guitar in it he will like. I know some bands he likes are Pink Floyd, Maroon 5, Weezer, and Blink 182. So far I've got


"Island in the Sun" by Weezer


"Dammit" by Blink 182


"Falling On" by Finger Eleven


maybe:


"Adam's Song" by Blink 182


"My Name is Jonas" by Weezer


"The Rock Show" by Blink 182


"First Date" by Blink 182


for the last 2 songs I don't know if the lyrics will scare him...


Also I am going to be including a note with this c.d. telling him that I like him. Eek! To those who answer, thanks so much!

Guys: What else should I put on his c.d.?
money by pink floyd


comfortable numb by pink floyd


another brick in the wall by pink floyd








good luck with ur cd :)


I have a Schecter C-1 (Hellraiser). The eyelets below the bridge are coming loose. How can I fix this?

Specifically, the eyelets below the bridge are on on the strings (Low) E and A. Now, I noticed that when I play (Earnie Ball Power Slinkys 11-42), and put a lot a "bend" into the strings, that there is a "metallic" sound. (Almost like the strings are rubbing against the metal eyelet.





I play thru a Marshall 100w, and on low distortion, it is failly noticible! (w/ high distortion, you can't hear it at all!).





I've owned/played countless other electrics including Schecters, but this specific C-1 Hellraiser is the first one I've ever seen/heard/or played that does this).





PS: thinking that it might be the strings, in the past 4 months, I have tried Elixirs, GHS's, DR's (Black Beauties), Black Diamond's, Dean Markley's, and now Ernie Ball's. It's not the strings!





Anyone every heard of this???? If so, how can I fix it!

I have a Schecter C-1 (Hellraiser). The eyelets below the bridge are coming loose. How can I fix this?
Take off the string. Work the eyelet up so you can get a very small drop of super glue between it and the body. Push the eyelet back down firmly. Be careful not to get the glue on the finish. (a toothpick can help). It sounds like the inside of the eyelet has a rough spot that the string is rubbing against. Take an old wound E string and rub it in and out like a file. If that doesn't work, you can get new eyelets from www.stewmac.com.

gardenia

Simple C++ question?

i am trying an example from a book and i cant quite get it yet. hope you can help me.





Question: DECLARE A CHARACTER ARRAY, AND INITIALIZE IT TO A SUITABLE STRING. USE A LOOP TO CHANGE EVERY OTHER CHARACTER TO UPPERCASE. (HINT: ASCII UPPERCASE COUNTER PARTS ARE 32 LESS THEN THERE LOWERCASE )





so i have to use this arithmetic way no. no built in function in a library.





this is what i have so and cant figure out.





#include %26lt;iostream%26gt;





using namespace std;





int main()


{


char c[] = "hello world!";





int count = 0;





for( int i = 1; i %26lt; count; i = i + 2)


{


count++;


c[i] = i - 32;


cout %26lt;%26lt; c[i];


}


//cout %26lt;%26lt; c;








return 0;


}





i thought i have everything right except the cout %26lt;%26lt; part however you do it.





any help or suggestions..thanks

Simple C++ question?
first of all,you have wrongly declared the counter variable count.


The loop will exit after one pass. Also, it should be c[i]-=32; or


c[i]=c[i]-32;





try this code instead of the for loop


i=0;


while(c[i]!='\0')


{


c[i]-=32;


i++;


}
Reply:The answers above is somehow incorrect, but some users have suggested good stuff.





I am gonna present you with a solution similar to yours, but I have seen some indexing problems with yours, you have to realize an array starts at POSITION 0 not 1, and in the for loop, you just place i++ to increment to the next position from the character array.





But you have to realize that there are incorrect strings and incorrect symbols, a proper way is to do the following:





http://rafb.net/p/GoMp5X43.html


===========================


char c[] = "hello $^^#67world!";





int count = sizeof(c) - 1;





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


{


// Now only convert when it is a small character


if(c[i] %26gt;= 'a' %26amp;%26amp; c[i] %26lt;= 'z' ) c[i]-=32


}





cout %26lt;%26lt; c;


===========================





That will print out the correct line, and all the symbols will stay intact, so "Hello World!" = "HELLO WORLD!"





Now notice the condition i placed? It should be between a to z.





Now that should work correctly since I tested it here.





Good Luck :)
Reply:What do you mean by "can't figure it out"... you need to say what your problem actually is. The code you have posted seems to be a strange mix of C# and C++... this is not going to work, you need to use one language.





"using" is a C# thing. And you aren't using it correctly anyway. The C# "using" statement when used as a precompiler directive, will import a library in the same way that #include did for C++ and C languages.





These are the things you need to think about for this:


1. what to do if a letter is already uppercase


2. how to determine the end of the string (is it null-terminated, or length-prefixed)


3. How to deal with numbers, whitespace, and control characters.





You have an error in your loop. Look at what you did very carefully. First, you set a variable called 'count' to be zero. Then, you declare a loop and a new integer called 'i', and you initialize 'i' to be 1. Then you say that the loop condition is supposed be "i less than count", which is false the first time in, so the loop never runs.
Reply:One little thing to beware of is that you will also be subtracting


32 from the space when i = 5. This will convert that space into a null, which will prematurely terminate the string.


I wanna write a program in c++ to print itself without including something,can anyone help me?

Please give explanation in addition to the program itself

I wanna write a program in c++ to print itself without including something,can anyone help me?
I don't know C++. But You can do it by sending the text in to prn folder. Same thig you can do it in DOS type a.txt %26gt;prn


Basic C++ help using Microsoft Visual C++ 2005 Express?

i am encountering 2 errors upon building when using the following code





#include%26lt;iostream%26gt;


#include "stdafx.h"


int main()


{


cout%26lt;%26lt;"*"%26lt;%26lt;endl;


cout%26lt;%26lt;"**"%26lt;%26lt;endl;


cout%26lt;%26lt;"***"%26lt;%26lt;endl;


cout%26lt;%26lt;"****"%26lt;%26lt;endl;


cout%26lt;%26lt;"*****"%26lt;%26lt;endl;


cout%26lt;%26lt;"****"%26lt;%26lt;endl;


cout%26lt;%26lt;"***"%26lt;%26lt;endl;


cout%26lt;%26lt;"**"%26lt;%26lt;endl;


cout%26lt;%26lt;"*"%26lt;%26lt;endl;


return 0;


}








any ideas what i am doing wrong? i am getting these errors


error C2065: 'endl' : undeclared identifier and


error C2065: 'cout' : undeclared identifier








is there a special thing i need to "#include" ? apparently, using namespace std; is useless with C++Express 2005. i dunno?

Basic C++ help using Microsoft Visual C++ 2005 Express?
one of two things:





1 change the line #include%26lt;iostream%26gt; to


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





2 use #include "stdio.h" or #include %26lt;stdio.h%26gt;
Reply:i think you forgot to put a namespace declaration.


using namespace std;





also, you might have to include %26lt;iomanip%26gt;, some manipulators for iostreams need it.
Reply:does it say what line the error is on?





what are you trying to do? output all those stars? thats easy.





but idk abotu stdafx.h ive never used that portion of your code.





and personally i prefer not to use the "%26lt;%26lt;end" way of breaking a new line so heres what i think u should do





#include %26lt;iostream%26gt;


using namespace std;


int main(){





cout%26lt;%26lt;"*\n";


cout%26lt;%26lt;"**\n";


cout%26lt;%26lt;"***\n";


cout%26lt;%26lt;"****\n";


cout%26lt;%26lt;"*****\n";


cout%26lt;%26lt;"****\n";


cout%26lt;%26lt;"***\n";


cout%26lt;%26lt;"**\n";


cout%26lt;%26lt;"*\n";


return 0;


}





i dont think your copying and pasting your code correctly because if it says cout isnt a declared identifier your either missing a ; at the end of one of your lines, or your missing a "" or you may have accidently typed cout%26gt;%26gt; instead of cout%26lt;%26lt; or you may have only 1 %26lt; instead of 2.





that should cover all your mistakes.
Reply:Looks good to me. Just a guess... there doesn't appear to be a space between the #include and the %26lt;iostream%26gt;
Reply:declare the var?





ie: endl = 0 ?
Reply:an indeclared identifier is an undeclared variable you have no variable declarations


in regular C++ code this would be written as follows


#using


using namespace System;


int main()


{


//declare variables


CODE GOES HERE FOR VARIABLES example below


double exNum1=0.0;


double exNum2=0.0;


double exTotal =0.0;





// get input


Code Goes Here again example below


Console::Write("Get num 1: ");


exNum1= Convert::ToDouble(Console::ReadLine());


etc.





//do some sort of processing


CODE GOES HERE example below


exTotal = exNum1 + exNum2;





// display result


Code goes here example below





Console::Write("The Total is {0}: exTotal.ToString());





//end main


return 0;


}
Reply:#include "stdafx.h"





should be





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





and you need to include the windows.h or win.h, somthing like that.


Need help with my c program?

i need my program to read in a file reverse it then write the file out.


i got the reverse correct but its not working.


my errors are:


n.c:12: warning: passing argument 1 of 'fopen' from incompatible pointer type


n.c:21: warning: passing argument 1 of 'fopen' from incompatible pointer type


n.c:22: warning: passing argument 1 of 'fputs' from incompatible pointer type


n.c:22: error: too few arguments to function 'fputs'





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


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


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


int main() {


char string[256];


char*filename[256];


char*outfilen[256];


char c;


int len;


FILE * infile=0;


FILE * outfile;


infile=fopen(filename,"r");


fgets(string, sizeof string, stdin);


len = (strlen(string) - 1);





printf("Reverse string:\n");


for(; len %26gt;= 0; len--)


printf("%c",string[len]);





printf("\n");


outfile=fopen(outfilen,"w");


fputs(outfile);


fclose(infile);


fclose(outfile);


}

Need help with my c program?
fputs() takes two arguments. You need to pass in "string" as well as the file, like this:





fputs(string, outfile);
Reply:Based on my experience in Java,


I think the cause of the warning is that you defined a pointer for the variable (filename)


which I quite don't understand why..


try do declare it like that : char filename[256]


About the Error:


here is the right format for the function fputs:


int fputs ( const char * str, FILE * stream );


All what you have to do is to provide the string you've defined..something like that :


fputs(string, outfile);





-cheers
Reply:A lot of issues here. This version compiles with gcc.


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


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


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


int main() {


char string[256];


char filename[256];


char outfilen[256];


char c;


int len;


FILE * infile=0;


FILE * outfile;





infile=fopen(filename,"r");


fgets(string, sizeof(string), stdin);


len = (strlen(string) - 1);





printf("Reverse string:\n");


for(; len %26gt;= 0; len--)


printf("%c",string[len]);





printf("\n");


outfile=fopen(outfilen,"w");


fputs(string,outfile);


fclose(infile);


fclose(outfile);


}





Note, the arrays are now arrays of 256, not pointers to arrays of 256.





in fgets, sizeof is a function, which means it on't compile unless you write sizeof(string) not sizeof string.








And of course, you reverse the string to stdout, but not to the outfile. That I haven't done anything about fixing. I wouldn't initialize infile when you declare it, incidently. Since you are going to reassign it it might help keep things straight if you assign it down below in the functions. Keep initializing in declarations to consts. That's just preference.

aster

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'


How to write pseudo code in c++ program. what the tech.?

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


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


void main()


{


int a,b,c,d,e,f,g,i,tmp,tmpf,tmpg;


double fact=1;


clrscr();


cout%26lt;%26lt;"\t\t Please Enter 7 Number Between 0-100\n\n";


cout%26lt;%26lt;"Enter The value of A = ";


cin%26gt;%26gt;a;


cout%26lt;%26lt;"Enter The value of B = ";


cin%26gt;%26gt;b;


cout%26lt;%26lt;"Enter The value of C = ";


cin%26gt;%26gt;c;


cout%26lt;%26lt;"Enter The value of D = ";


cin%26gt;%26gt;d;


cout%26lt;%26lt;"Enter The value of E = ";


cin%26gt;%26gt;e;


cout%26lt;%26lt;"Enter The value of F = ";


cin%26gt;%26gt;f;


cout%26lt;%26lt;"Enter The value of G = ";


cin%26gt;%26gt;g;


clrscr();


cout%26lt;%26lt;"\t\t\t\tThe Entered Numbers are";





cout%26lt;%26lt;"\nA="%26lt;%26lt;a%26lt;%26lt;"\nB="%26lt;%26lt;b%26lt;%26lt;"\nC="%26lt;%26lt;c%26lt;...


cout%26lt;%26lt;"The Sum Of First Two Numbers is = "%26lt;%26lt;a+b;


cout%26lt;%26lt;"\nThe Average of first three numbers is = "%26lt;%26lt;double(a+b+c)/3;


cout%26lt;%26lt;"\nThe Product of last two number is = "%26lt;%26lt;f*g;


//Logic For finding Greatest of all Numbers


if(a%26gt;b%26amp;%26amp;a%26gt;c%26amp;%26amp;a%26gt;d%26amp;%26amp;a%26gt;e%26amp;%26amp;a%26gt;f%26amp;%26amp;a%26gt;g)


cout%26lt;%26lt;"\nThe Greatest Number is = "%26lt;%26lt;a;


else if(b%26gt;a%26amp;%26amp;b%26gt;c%26amp;%26amp;b%26gt;d%26amp;%26amp;b%26gt;e%26amp;%26amp;b%26gt;f%26amp;%26amp;b%26gt;g)


cout%26lt;%26lt;"\nThe Gr

How to write pseudo code in c++ program. what the tech.?
Psuedo code is just a way of describing a program, algorithm, etc.


For instance, Pseudo code for an algorithm calculating the maxmimum of two integers could be: (Note: Psuedo code can be written any way, with the main concepts being the same)


// Algorithm for finding the maximum of two integers


input arguments: a, b


output arguments: c


compare a with b


if b is greater than a,


then make c equal b,


return c;


else


then make c equal a,


return c;





Whereas code in c++ could be something like:


int max(int a, int b) {


if (b %26gt; a) {


return b;


} else {


return a;


}


}





Note: the above is a simple implementation for beginners. For experts, it could be changed to:


int max(int a, int b) {


(b %26gt; a) ? return b : return a;


}


For all the people who say, its easier to use this or to do that.


Hope this explains psuedo code.


What's a good book for learning C++?

I'm taking an Independent Study course next year (senior in High School) and would like to learn C++. I need to write a proposal and include all resources, including books and programs, I will need. I will have the assistance of a teacher, but it's really independent learning, so he will only be there to guide me.


I took a computer science course in java last year, and will take Computer Science II (AP) next year. I'm good with computers and know some PHP, so programming isn't entirely new to me. Can anyone recommend any software and books I'd need to learn C++?

What's a good book for learning C++?
Books:


It is important you get a book that is *technically accurate* and *up-to-date*. There's a large number of books that are obsolete (C++ changed radically after the 1999 revision) or are written by incompetent authors.





Take a look at this site: http://accu.org/index.php/book_reviews?u...





The books are reviewed for technical accuracy. From personal experience, I think the books C++ Primer by Lippman (search for Lippman C++ in Amazon) and Accelerated C++ by Koenig are very good books to learn from. The C++ Programming Language Special Edition by Stroustrup (by the guy who made C++) is a must have book, if you already know intermediate C or C++. If you're just starting out, that books will be too much and too high a level for you.





If you already are a programmer, you know that need a plain text editor or IDE. With C++, you need a compiler to convert your code into an executable (the process is actually a bit more complicated than Java's). Anyway, you should be using one of two compilers. gcc (or MinGW on Windows), or Visual C++. gcc is free. Visual C++ has a free version called Visual C++ express.





If you have programmed before, then you know the rule: when you have a question or want to know about something, Google it first. Google, and google on C++. I'll give you a few links to some useful sites.





C++ FAQ: http://www.parashift.com/c++-faq-lite/ (the material addresses most of the beginner problems, as well as many intermediate ones)


C FAQ: http://c-faq.com/ (you need this even if you learn C++)


Cplusplus.com: http://www.cplusplus.com/ (for the library references)


Cprogramming.com: http://cprogramming.com/ (for their tutorials, accurate and extensive).


http://www.cppreference.com/ (another library reference).
Reply:The C++ Programming Language (Special 3rd Edition)


http://www.amazon.com/C%2B%2B-Programmin...


How do I do this C programming???

I'm trying this "hello world" program and every time I compile the SC, this error message appears:


C:\Program Files\Miracle C\hello.c: line 1: Parse Error, expecting `SEP'


'1: include %26lt;stdio.h%26gt; 2: 3: int radius, area'


aborting compile

How do I do this C programming???
since you didnt show your code, the only thing I see is "include %26lt;stdio.h%26gt;" should be #include %26lt;stdio.h%26gt;, and int radius, area should be int radius, area;. Other than that, who knows without seeing the code you wrote.
Reply:post the source code
Reply:I think there are two booboos here. Try :





#include %26lt;stdio.h%26gt; /* No ; after the lines with a # */





int radius, area; /* Must have ; after normal lines of C */





This is true because the first line is a line intended for the C preprocessor. The second line is a line of standard C code, declaration of two integers named radius and area, to be specific.





I hope this will help you out with the general format.
Reply:All preprocessor directives start with #


That is, instead of


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


mut be:


#include %26lt;stdio.h%26gt;
Reply:The error message is specific to the compiler you're using: Miracle C (http://www.c-compiler.com/guide/errmessp... ). To put is simple, expecting a SEP means the compiler expects you to put a semicolon in a place that you don't put a semicolon in.





AFAIK, preprocessor functions isn't ended with a semicolons, so your code should actually compile correctly.





My guess is, perhaps your DOS environment doesn't recognize the symbol #, so it passes the # symbol as nothing, and this makes Miracle interpret it as a normal C functions. The reason for this is: the error message states "1: include ... " %26lt; the # doesn't appear on this message, while you actually have a # in the source code.
Reply:Which compiler are you using ,programming an hello world in c program is the easiest one .


In Linux , open a text file using vi editor and type your program , save it using wq! , and type gcc %26lt; program name%26gt; . this will create a.out , run that , if any args needed from command line. For other os , search in google.

marigold

Solving a cubic in C - not working - why?

/*


** Solve a cubic polynomial


** By xxxxxxxxxx


*/





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


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


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








double a1,a2,a3,b,c,d,G,S,x1,x2,x3,x4, C, theta, P, Q, sign;


double acos (double x);








int main()


{








printf("Please enter the coefficient of x^2:");


scanf("%f",%26amp;a1);


printf("Please enter the coefficient of x:");


scanf("%f",%26amp;a2);


printf("Please enter the constant term:");


scanf("%f",%26amp;a3);





Q=(((a1*a1)-(3*a2))/9.0);


printf("Value for Q is:%f\n",Q);





S = ((2*(a1*a1*a1))-((9*(a1*a2))+(27*a3)))/5...


printf("Value for S is:%f\n",S);





/*theta=acos(S/sqrt(Q*Q*Q));


printf("Value for theta is:%f\n",theta);*/





P= pow ( (sqrt( (S*S)-(Q*Q*Q)+fabs(S) )), 1/3);





C = ((Q*Q*Q)-(S*S));





if (C%26gt;=0)


{


theta=acos(S/(sqrt(Q*Q*Q)));


x1 = ((-2*sqrt(Q))*(cos((theta)))/3.0) - (a1/3.0);


x2 = ((-2*sqrt(Q))*(cos((theta+2*3.1412)))/3.... - (a1/3.0);


x3 = ((-2*sqrt(Q))*(cos((theta+4*3.1412)))/3.... - (a1/3.0);


printf("First root: %f.\n", x1);

Solving a cubic in C - not working - why?
One possible problem is the use of the error-prone scanf() function. You've declared your variables as double, but you're using the float format identifier "%f". For doubles, you need "%lf".





If you're using C++, prefer to use iostreams:





double Q;


std::cout %26lt;%26lt; "Enter your number:" %26lt;%26lt; std::endl;


std::cin %26gt;%26gt; Q;


Cell phone A call B, B forward to C. Is B's number included in the package(ANI) sent to C?

Hi there....





The original calling party will show on ANI (phone A's number).





Hope this helps!


C++: How to create an MFC application that will rename files in a directory?

As a part of a larger MFC application written in C++ (Visual Studio 2005), I would like to include a function that will read in all the filenames in a given directory and rename them to append the date that the file was created to the end of the filename.





Thus, files that were previously named, "hello.txt" and were created on 1/1/2007 would now be named, "hello010107.txt".





Is there an easy way to do this? Keep in mind, this is an MFC application (with windows, buttons, forms, etc), not a console application.

C++: How to create an MFC application that will rename files in a directory?
Here ya go:





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





void TimeStampFiles(CString Path)


{


// enumerate all files in the directory and place them in an array


CStringArray files;


CFileFind finder;


BOOL bWorking = finder.FindFile(Path + "\\*.*");


while (bWorking)


{


// ignore directories


bWorking = finder.FindNextFile();


if (!finder.IsDirectory())


files.Add(finder.GetFilePath());


}





// now cycle through the array


for (int i=0; i%26lt;files.GetSize(); i++)


{


// get the file path, title and extension


CString path = GetPath(files[i]); // e.g. "c:\\dir\\"


CString title = GetTitle(files[i]); // e.g. "name"


CString extension = GetExtension(files[i]); // e.g. "ext"





// get the time for this file


CTime time;


finder.GetCreationTime(time);





// construct the string


CString timeString = time.Format("%m%d%Y");





// construct the new filename


CString newName = path + title + timeString + "." + extension;





// rename it


CFile::Rename(files[i], newName);


}


}





What this does is first enumerate all the files and place them in an array....you don't want to be modifying the contents of a directory while you're looping through it. It then goes through the array and names each file at a time. The only functions I haven't implemented are the 3 that seperate the full path and filename into the path, the file title and the extension, but they should be easy enough to look up.





Enjoy!
Reply:You can do it, but there is no 'easy way' shortcut.





You need to use FindFirstFile() and FindNextFile() to iterate through the files in the directory. Here's sample code: http://netez.com/2xExplorer/shellFAQ/bas...





Be sure to explicitly ignore '.' and '..' when iterating through the file names and also ignore subdirectories. See sample code for how to determine whether you're looking at a filename or a subdir name.





Collect all the valid file names into a container (vector would work). Once you are done getting all the file names, start iterating through your vector. Parse the existing file name at the dot, and build your new file name, then call ::MoveFileEx( ) to rename the file. Be sure you use the full path in the file names.





How are you planning to use this? You'll only be able to run it once on a directory. If you run it a second time, you'll keep expanding the already-renamed files with more date decoration. Maybe you need a more unique naming convention so you can decide that the file is already renamed and leave it alone.


C++ 2nd Project?

Hmmm.. I need an idea for my upcoming C++ Project. The theme is "animation". We must include the delay() function in the program.





My best bet will be making "falling text" like the ones in the Matrix. Wow! But I'm not sure this animation will perform well. I need to use the String() class and making positioning accurately while maintaining the algorithms to run efficiently.





Another bet is to make.. to make.. I dunno.. Hahahahahaha.. I have been pretty stressful lately because of the upcoming monthly test.

C++ 2nd Project?
well any of the simple screen savers that you see with windows should be do-able


- scrolling text


- bouncing balls


- rebounding light rays


- multicoloured squares increasing in sizes etc
Reply:Is this supposed to be something basic? You could just draw like a filled in circle and have it bounce around the screen?

dracaena

Why this c program is going infinite!!!!!!?

Program is to find no. of days between 2 dates.Logic is to add 1 day to 1 date till it reaches other.


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


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


void main()


{


int a,b,c,d,e,f,flag=0;


printf("Enter first date");


scanf("%d%d%d",%26amp;a,%26amp;b,%26amp;c);


printf("Enter second date");


scanf("%d%d%d",%26amp;d,%26amp;e,%26amp;f);





while(c!=f||b!=e||a!=d) //If I comment c!=f this program works otherwise it goes infinite!





{


a++;


if((b==4)||(b==6)||(b==9)||(b==11))


f=30;


else if(b==2)


{


if(d%4==0)


f=29;


else


f=28;


}


else


f=31;


if(a%26gt;f)


{


b++;


a=1;


}


if(b==13)


{


c++;


b=1;


}


flag++;





}


printf("%d",flag);


getch();


}

Why this c program is going infinite!!!!!!?
Why don't you first calculate the julian value and then just subtract the two dates?





For example, if they enter 2007 01 31 for the first date and


2007 02 10 for the second, the first date would calculate to 2007031 and the second is 2007041. Subtracting, you then get 10 days.





The following hasn't been compiled or checked for complete accuracy, but should give an idea.








int main() {


int date1, date2, daysDiff=0;


/* blah blah blah - get your dates... */





date1 = jetJulian (a,b,c);


date2 = jetJulian (d,e,f);





if (date1%26lt;date2)


daysDiff = date2-date1;


else


daysDiff = date1-date2;





}





int getJulian(int year, int mo, int day) {


int jValue=0;


int moDays[11]={0,31,59,90,120,150,181,212,2...


/* Double-check the values above :) */





/* Add some verifications prior to the following */


jValue = moDays[mo-1]+day;





/* Add one if the mo%26gt;2 and leap year */


if ((year%4 %26amp;%26amp; !year%100) || year%400)


jValue++;





jValue+= year*1000;


return jValue;


}
Reply:i did this program


its to find persons age


%26amp; hw many days he lived


its very simple


first u substracted the old year from recent year


than answer*365


other line


subtract large month to smaller 1


than answer*30


than just add the days


ok that was mine


i wont do ur prob


i might get answer 2moro


when i go to my class


Is weaning off a ventilator from A/C better than weaning off from SIMV?

It has been suggested that weaning a patient off a ventilator is more successful if you mechanically ventilate them on A/C mode, titrate the mechanical rate to 4, and perform intermittent CPAP trials rather than mechanically ventilating them on SIMV mode, titrating the mechanical rate to 4, then proceeding to intermittent CPAP trials. Reasons for this include completely "resting" the patient on A/C in order to have a successful CPAP trial, and also maintaining a patient trigger by decreasing the mechanical rate before CPAP.





Followers of the SIMV method of weaning suggest that the patient must be allowed to slowly resume the task of breathing to allow for a successful CPAP trial by having their mechanical respiratory rate titrated from a high rate to a low rate before the initiation of CPAP. This allows for more spontaneous breathes to occur.





With the eventual extubation of the patient in mind, which method is more effective/efficient and why? For what kind of patients and ailments?

Is weaning off a ventilator from A/C better than weaning off from SIMV?
That is an opinion. SIMV is the way to go in my opinion. I like the SIMV mode because it allows the patient to do their own breathing if they so desire.
Reply:maybe

morning glory

C++ Programming?

any body know hw to make a C++ program through turbo C++. i want a program fr my school project bt a very very simple program nt much lib function we r not thought those things being the 1st year. programs like calculator, hotel management,hospital management, salary scale or any thing like this...... a simple program i am ritin just as an example.....


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


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


void main()


{


int a,b,c;


cout%26lt;%26lt;"\n Enter the numbers to be added";


cin%26gt;%26gt;a%26gt;%26gt;b;


c=a+b;


cout%26lt;%26lt;c;


getch();


}


so any1 get it pls help me i hv to submitt it aftr 2 days thnx i sppericiate

C++ Programming?
if you don't like to do your homework yourself


search the link below.


but i suggest you do this yourself,it will be fun.
Reply:You get an homework help


at


http://softwaretutorial.info/
Reply:You aren't going to get far with the typing like that, good luck. Btw it will take more than 2 days to do it.


Compile errors in my header file? why? c++?

before in my header file i had this:


File Edit Options Buffers Tools C++ Help


#ifndef SWAP_H


#define SWAP_H


//#include %26lt;string%26gt;


//#include %26lt;iostream%26gt;


using namespace std;





void swap (string %26amp;, string %26amp;);





#endif


-------


that gave me these compile errors:


Swap.h:7: error: `string' was not declared in this scope


Swap.h:7: error: parse error before `,' token


------


now i have:


#ifndef SWAP_H


#define SWAP_H


//#include %26lt;string%26gt;


//#include %26lt;iostream%26gt;


using namespace std;





std::void swap (string %26amp;, string %26amp;);


#endif


------


Swap.h:7: error: `string' was not declared in this scope


Swap.h:7: error: parse error before `,' token


---


ALL this happens when i try to compile my Swap.cpp file.. help? wats wrong?

Compile errors in my header file? why? c++?
The compiler doesn't know what a "string" is.





uncomment the #include %26lt;string%26gt; and add


using std::string;


C programming... I can't find what's wrong with my code.?

The program is supposed to ask the user for the number of characters of which the side of a square is to be built, and the characters of which it's to be built.


As so:





enter number for side of square: 3


enter a character: %26amp;





%26amp;%26amp;%26amp;


%26amp;%26amp;%26amp;


%26amp;%26amp;%26amp;








I can't seem to get it to work... Here's what I have:





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





int fillBox( int n, char c);





int main() {








int n;


char c;





printf("How many characters long would you like your square, sir?\n");


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


printf("A very wise choice.\n Enter a character you would like your square to be composed of: ");


scanf("%c", %26amp;c);





printf("%c", fillBox(n, c));





}


int fillBox(int n, char c) {





int side, i;





side = n;





for(i=0; i%26lt;=side; i++)


{


printf("%c", c);





if( i % side == 0)


printf("\n");








}


}








Any advice?

C programming... I can't find what's wrong with my code.?
instead of int use void in the fill box function and just use plain call like fillbox(n,c); in place of printf("%c", fillBox(n, c));





now in function u need double loop


for(i=0;i%26lt;side;i++)


{


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


{


printf("%c",c);


}


printf("\n");


}


just replace the loop code with this
Reply:I tried to modify your code and get some output but you require atleast one more for loop to get desired loop in fillbox function.








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





void fillBox( int n, char c);





int main()


{


int n;


char c;


clrscr();


printf("How many characters long would you like your square, sir?\n");


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


fflush(stdin); //it is used to clear buffer(memory)


printf("A very wise choice.\n Enter a character you would like your square to be composed of: ");


scanf("%c", %26amp;c);





fillBox(n, c);





getch();





}


void fillBox(int n, char c)


{





int side, i;





side = n;








for(i=1; i%26lt;=side; i++)


{


printf("%c", c);


if(i%side==0)


printf("\n");








}


}
Reply:I'm not sure what is going wrong. (where do you see the problem at) but from looking for it you only have one for loop. This would only do one line, you need another for loop to do either next rows or the columns Just add another for loop after the current one.


for(i=0; i%26lt;=side; i++)


{


for(r=0; r%26lt;=side;r++)


{


printf("%c", c);
Reply:1. The int fillBox( int n, char c) function is void, it just prints.


2.When reading characters the variable must be a string, thus c is char* c, thus we have scanf("%s",%26amp;c)


3.The function does the printing you don't need to call it in the printf command


4.It needs a nested loop as mentioned before.


5.In a loop when you start from 0 and you want 'side' iterations you have to write i%26lt; side
Reply:You need two loops (nested).





for (i=0; i %26lt; side; i++)


{


for(j=0; j %26lt; side; j++)


{


printf("%c", c);


}





printf("\n");


}








what you are doing will not work. When you are traversing the loop, see what happens:





Say n = 3 and c = '%26amp;'





you enter the loop, i = 0





Output :%26amp;





0 % 3 != 0





then you enter loop again





and keep printing %26amp;





Output is :


%26amp;%26amp;%26amp;%26amp;%26lt;newline%26gt;





So better go with a simple nested loop.





I have not tried it out and it may need some tweaking. You can do that. After you write a program, try to work out on a paper what a computer would do. It is possible for small programs like these and will help you to understand the concepts.





Good Luck.
Reply:This code won't compile exactly as written here, but I'm assuming you've tweaked your code so it does compile.





Your main problem is the use of scanf with %c. Scanf with %c does not ignore whitespace, so I think you are immediately scanning in white space instead of waiting for user input.





Check out this link for a discussion of this. It suggests using getchar instead. http://www.geocities.com/learnprogrammin...





Once you get that working, I think you'll have to tweak your for loop to get the exact output you want. You'll be on your way, though!





Good luck.
Reply:check for obvious such as spelling mistakes and wrong symbols spaces etc


I need ASUS A7V266-C Rev. 2.00 drivers including on board sound and chipset.?

asus site is sometimes hard to navigate. You will need to look harder at the ARCHIVES under socket A.

I need ASUS A7V266-C Rev. 2.00 drivers including on board sound and chipset.?
www.asus.com go to support and find you product then download any drivers

geranium

Help with C++ Program ?

Program takes celsius degree


// and converts it to fahrenhite


// in increments of 5





#include %26lt;iostream%26gt;





using std::cout; // program uses cout


using std::cin; // program uses cin


using std::endl; // program uses endl





#include %26lt;iomanip%26gt;





using std::setw;





int main()


{


int c, f, even, odd; // declares variables





cout %26lt;%26lt; "Input data in intervals of 5" %26lt;%26lt; endl;


cout %26lt;%26lt; "Start from 0" %26lt;%26lt; endl;





for (f = 0; f %26lt; 100; f++)


// Counter to loop a hundred times


{


f = f*5;


c = (.5555556)*(f-32);





if( c %26amp; 0x00000001 )


{


c = even;


}


else


c = odd;





cout%26lt;%26lt; setw( 5 ) %26lt;%26lt; "Odd"%26lt;%26lt; setw( 5 ) %26lt;%26lt; "Even" %26lt;%26lt; endl;


cout%26lt;%26lt; setw( 5 ) %26lt;%26lt; odd %26lt;%26lt; setw( 5 ) %26lt;%26lt; even %26lt;%26lt; endl;





// conversion Formula set to c


cout %26lt;%26lt; "The Celsius equivalent is: " %26lt;%26lt; c;


// printout statement


if(c %26lt; 35)


// Checks to see

Help with C++ Program ?
..yikes, what are you trying to do!?


is it a program that takes C, converts it to F, and THEN adds 5 , or is it a program that displays the C temperature in F, in intervals of 5?


the latter sounds more reasonable, I guess...but ONE of your problems is that you are using your loop controls as variables to convert the temp, so after the firs time in your first for loop the variable goes to 6, the second time to 30, and then to 150!! don't use the F variable as loop control if it is for conversion, unless you are going to restore back its value after the conversion, in which case makes no sense...you should just use ANOTHER variable for loop control
Reply:Your temperatures should be floats.
Reply:sorry, i'm not entirely sure about what youre trying to do...


but to convert a temp C to F i would do this





int main (void)


{


double c, f;





cout%26lt;%26lt;"Enter a temperature in degrees Celsius: ";


cin%26gt;%26gt;c;


cout%26lt;%26lt;endl;





f = 9.0/5.0*c + 32;





cout%26lt;%26lt;c%26lt;%26lt;" degrees Celsius is equal to "%26lt;%26lt;f%26lt;%26lt;" degrees Fahrenheit.";





return 0;


}








If you're trying to make a scale of temperatures, something like


0C = 32F


5C = 41F


10C = 50F


15C = 59F


...one hundred times, make a loop that


-changes C to F


-prints value of C and F


-adds 5 to C


something like





double c = 0, f;





for(int loop = 0; loop %26lt; 100; loop++)


{


f = 9.0/5.0*c + 32;


cout%26lt;%26lt;c%26lt;%26lt;"C = "%26lt;%26lt;f%26lt;%26lt;"F"%26lt;%26lt;endl;


c += 5;


}





hope this helps you, good luck with the programming.


I had caught a viruse, reformated my P.C., and got everything back together, for now, that is!!?

I had caught a viruse, reformated my P.C., and got everything back together, for now, that is!! I had caught a viruse, and tried one of those spybot websites, and downloaded a quoted, free Spyware, only for this to dump over 1,200 viruses, including worms into my P.C., then the free program asked me, if I would like to by the software now, to get rid of all 1,200 infections, not including the first one that I had caught!! That sucked, having reformat, reprogram my P.C., and make recovery discs, for the next time this happens!! All I want to know is, where in the hell can I get a FREE Antviruse all in one program, to get rid of the following viruses: Adware,Spyware, Trojans, Malware, Lot's, worm's, ya know, the real Mc Coy viruses, that will make you have t throw your P.C. away, not the V's that aggrivate ya!! I'm talking about the ones that really bite into your DLL, Mother Board/etc!! Does anyone out there have this such program, that will detect all viruses that your P.C. catches!!

I had caught a viruse, reformated my P.C., and got everything back together, for now, that is!!?
when you talk about this spyware program you used, was it an online scan? if so, all those viruses and what not showing up on that scan may not even be there. it is often used as a scare tactic to buy their software. take everyone else's advice on using either avg or avast. and for antispyware, lavasoft adaware is good, search and destroy spybot, superantispyware, but the best are the ones you purchase. i run spy sweeper on my daughter's pc and no problems with spyware ever and only 30 bucks a year, but what most people dont know is when you repurchase they let you buy it at 20 bucks every year after and usually add 6 more months for free. for antivirus, if you want to pay , try kaspersky. dump that other antispyware you have on there asap, could be real or could just be a scam.





good luck!
Reply:Windows Defender is pretty good...free from Microsoft's site. Ad-Aware is pretty good too and free from lavasoft. Advanced WindowsCare V2 personal is excellent as well. All free, but as far as firewalls go, I'm not to hip on the free ones for that.
Reply:You can use Avast free home edition %26amp; ad aware, links below. Some ISPs provide free security for your computer, check out your ISP's website. Sorry for your troubles.
Reply:AVG has a free antivirus software. Spybot and lavasoft adaware are others. These are mainly for spyware. For me though, i havent caught a virus for years and all i have is norton anti virus, windows firewall, and windows defender. I would suggest that you get zone alarm rather than using windows firewall. It is better for novices.
Reply:Most of the free programs only have 1 thing and if you want to get the rest of the features you have to buy the professional version. I use the free version of AVG and Ad-aware and I have never had a problem with viruses. Yes I have gotten some. But AVG always catches it right away.


Qualitative cold cathod C.L.thin section petrography including diagnectic sequence, minerologyand pore?

-SYSTEM EVOLUTION.

Qualitative cold cathod C.L.thin section petrography including diagnectic sequence, minerologyand pore?
this is similar to your last question but they used a cathodoluminescence (C.L.) microscope, which is like a combination of a normal light microscope and an electron microscope. It allows you to see more diagenetic features, and more reliably identify minerals, among other things.


Can somebody help me?please correct my errors (Turbo C)?

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


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


main()


{


int A,B,C,D,X;


clrscr();


printf("FIRST QUESTION 1+1=?);


printf("CHOICES A.2,B.3,C.4,D.5");


scanf("%i,%26amp;A);


if(A = ='A')


{


printf("Correct!!!")


}


else


{


printf("Wrong")


}





it doesn't work the way i want to..please help me..im just a 13 yr old..can anybody lend me a hand?thanks...

Can somebody help me?please correct my errors (Turbo C)?
#include%26lt;stdio.h%26gt;


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


main()


{


int ans;


clrscr();


printf("FIRST QUESTION 1+1=?);


printf("CHOICES A.2,B.3,C.4,D.5");


ans = getchar();


if (ans=='A' || ans=='a')


{


printf("Correct!!!")


}


else


{


printf("Wrong")


}


return 0;


}
Reply:You should either do a strcmp() or compare if(A==1) since you have A declared as an integer (and read in that way) but comparing it to a character. Unless you are looking to compare ASCII values... Also, you are missing an ending " in your FIRST QUESTION printf() statement.





And as matter of style, your main() function should return something or mark its return as void. And use useful variable names...
Reply:printf("FIRST QUESTION 1+1=?);


scanf ("%i,%26amp;A")


Dont give them a choice if you do, make it just


printf("CHOICES 2, 3, 4, 5");





A2 B3...its confusing huh?





int A=0;


int a=2;





/*int b=3;


int c=4;


int d=5; aren't being used yet*/





So you get a number.


Then


if( A==a)//compare their answer to your variable
Reply:put it on desktop reset windows

sweet pea

C++ programing, this is my study guide can you help me get the right answers?

1. Making a variable behave like a variable of a different data type is known as


a.typecasting


b.brute force


c.intimidation


d.variable casting


2. To redirect the input for a C++ program (theprog.exe) to come from a file rather than the keyboard you would:


a.theprog %26lt; infile.txt


b.theprog %26lt;%26lt; infile.txt


c.theprog %26gt; infile.txt


d.theprog %26gt;%26gt; infile.txt


3. if a do/while structure is used,


a) an infinite loop will not take place


b) counter controlled repetition is not possible


c) the body of the loop will execute at least once


d) an off-by-one error will not occur


4. A function prototype does not have to


a)include parameter names


b)terminate with a semicolon


c)agree with the function definition


d)match with all calls to the function


5. A function prototype does not have to


a)include parameter names


b)terminate with a semicolon


c)agree with the function definition


d)match with all calls to the function


6. For command line arguments you write your main function:


int main(int argc, char *argv[])


The argc refers to:


a.the count of the arguments passed


b.an array of pointers to strings


c.the number of people using the program


d.the size in bytes of the program

C++ programing, this is my study guide can you help me get the right answers?
1. a.


2. d.


3. c.


4. d.


5. isn't this #4?


6. a.
Reply:1. a


2. a -- I think


3. c


4.a - i think


5. same as 4 ?


6. a





Number 4 - example of prototype


void function(int number) will work if you do this as well


void function(int) I don't think poster above said it right








I know this will work.





Man whoever gave you the study guide -- really likes a answers :)





number 2 - site below answers the question. And thats what I thought before I went and looked, so I am right


Can you help me in C?

What function should I use to clear a screen in C? And what is the header file to include?





For example, my code is:





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


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


main()


{


printf("\nType anything!!!");


printf("\nType anything!!!");


printf("\nType anything!!!");


printf("\nType anything!!!");


getch();


// I want to place the code here that clears the screen...


}





Please help me... Im new in C...ü. Thanks

Can you help me in C?
Use clrscr(); just after the opening the main function. It works for C++ and it will surely work also for C; I didn't know they are so similar.
Reply:Now that you've included both header files, just use this:





clrscr();





That's the library function for clear screen. If you're on linux use:





system.clear();
Reply:Just use clrscr(). This function is defined in conio.h, and you have alreday included this file.
Reply:please use this





clrscr();





this is used for clear the screen


C-Sec./Due Date Question?

I'm due Aug. 14th, was due the 10th but the dr. doing the c-sec. moved it back.. but anyway.. He said they do the c-section 10 days before my due date.. and they don't do c-sections on the weekends, so do they include weekends in the 10 day period or not?

C-Sec./Due Date Question?
yes they do, when he says "ten days back" it means ten of YOUR days back, not of HIS working days.


yeah.... he DOESN'Tmean ten working days
Reply:I would say yes, I would expect they would do it August 4th, but if it landed on a Sat or Sun they would do it the following Monday. Good Luck! I loved my C-section!
Reply:you need to ask him this. and they do do c-sections on the weekend just not scheduled ones usually
Reply:Yes, they include weekends. I had this same problem. My doc wanted to do it exactly a week before the due date, but that was on a weekend. And since they like to leave early on Fridays, they scheduled it for the Thursday before that date. So my daughter was born (ironically, on August 10) a few days earlier than they usually would have done it.
Reply:I'm not sure on that one. if they dont do c-sections on weekends i would say if day ten fell on a saturday then do it friday or if day ten fell on a sunday do it monday. but im not sure you should talk to your dr and ask them when they will do the c-section. it never hurts to ask questions when you dont really know what to do. good luck.
Reply:Who knows! Just ask them when they are going to do the c section.
Reply:Don't know, that would have to be a question for your doctor. In my experience, each practice varies in when they do c-sections. My last doctor scheduled at 38 weeks. This group wants to schedule at 39 weeks.
Reply:I'm sorry you are in the position you are now in ... you'd have to ask the doctor about his 'ten days before' you are due 'limit' ... most doctors would want to wait until 10 days after unless there is a 'good medical reason' to do the c-section 'early' ... also WHY did the doctor 'move' your due date? Did it have something to do with the 'size' of your baby inside you, or some other reason? I'm SERIOUSLY WORRIED and think that you really should see 'another doctor' at a UNIVERSITY hospital, because there are all kinds of 'things' that are not 'right' about your question ... and go ASAP if you decide I'm right ... because if you want to you CAN SWITCH DOCTORS now, and in your case, I think it would be an EXTREMELY GOOD IDEA to at least 'think about doing it.'


C mysteries??

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


void main()


{


printf("%d%c");


}





the output of te program is


0 and X


how is it possible??





if you have programs like this sort ,plzz write in!i would love 2 know more!!!

C mysteries??
In your printf("%d%c");


you do not specify any variables or data to be printed.


Printf() "pretends" there is data anyway and prints it out (what the 0 and X are is whatever is on the stack at the time - return addresses usually).





try printf("%d%c", 123, 88 );
Reply:I think it can print anything. Since you have not specifed the format string properly, and these are the (were) major causes of vulnerability in server applications.


Printf() function will first read string and understand the format what to print and then will go on to read the data to print in that exact format specified. Since you have not provided the data/variable it will go in to the next address (pointer) to pick the data and for that it is going to print the garbage which is present there at that time.


I think its not necessary that it print 0 and X every time, across every platform/c-compiler.

rose

What is the average day rate for an electrician in London - not including expenses like Congestion C?

per job not per day.usually £30 per job

What is the average day rate for an electrician in London - not including expenses like Congestion C?
£40 per hour
Reply:about 120 aday
Reply:You don't want to know,believe me.


C++ error =(?

I'm programming a simple openGL program, but the compiler(Dev-C++) won't compile it, the code is: #include %26lt;gl/gl.h%26gt;


#include %26lt;gl/glu.h%26gt;


#include %26lt;glut.h%26gt; void RenderScene(void){


glClear(GL_COLOR_BUFFER_BIT);





glFlush();


}





void SetupRC(void){


glClearColor(0.0f,0.0f,1.0f,1.0f);}


void main(void){


glutInitDisplayMode(GLUT_SINGLE|GLUT_R...


glutCreateWindow("SIMPLE");


glutDisplayFunc(RenderScene);


SetupRC();


glutMainLoop();


} and the error message i keep getting is 'main' must return 'int', any suggestions?

C++ error =(?
Main must return int, meaning it must return a value whether it succeded or not. Instead of using void main(), you must use int main() and return 0 in case of succes or whatever you like...
Reply:I think you have to try removing the "void" between the main's brackets





or u can simply change your "void main" to --%26gt; "main" , and insert a "return 0;" statement before you go out the scope of the main (after u call "glutMaunLoop();" )


C programming language: is there an easier way to code the same thing?

We are asked to write a program that inputs three different integers from the keyboard, then prints the sum, the average, the product, the smallest and the largest of these numbers. The program does not have to account for invalid input (for instance, entering the same integer three times rather than using three different integers).





Here is an example of how the output of the program should look, with the integers 13 27 and 14:





Input three different integers: 13 27 14


Sum is 54


Average is 18


Product is 4914


Smallest is 13


Largest is 27





Is there an easier way (i.e. less lines of code) to code the same thing? Here is the code I have used, in-between the dotted lines:





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





#include "stdio.h"





int main ()


{


int a,b,c,sum,avg,prod;





printf("Input three different integers: ");


scanf("%d%d%d",%26amp;a,%26amp;b,%26amp;c);





sum = a + b + c;


printf("Sum is %d\n",sum);





avg = (a + b +c) / 3;


printf("Average is %d\n",avg);





prod = a*b*c;


printf("Product is %d\n",prod);





if(a %26lt; b %26amp; a %26lt; c) {


printf("Smallest is %d\n",a);


}





if(b %26lt; a %26amp; b %26lt; c) {


printf("Smallest is %d\n",b);


}





if (c %26lt; a %26amp; c %26lt; b) {


printf("Smallest is %d\n",c);


}





if(a %26gt; b %26amp; a %26gt; c) {


printf("Largest is %d\n",a);


}





if(b %26gt; a %26amp; b %26gt; c) {


printf("Largest is %d\n",b);


}





if (c %26gt; a %26amp; c %26gt; b) {


printf("Largest is %d\n",c);


}





}





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

C programming language: is there an easier way to code the same thing?
Put your input data into an array. You can then do all your calculations in one loop.





#include "stdio.h"


#include "limits.h"





int main ()


{


int i;


int array[3];





int sum = 0;


int avg = 0;


int prod = 1;


int smallest = INT_MAX;


int largest = 0;





printf("Input three different integers: ");


scanf("%d%d%d",%26amp;array[0], %26amp;array[1], %26amp;array[2]);





for (i = 0; i %26lt; 3; i++)


{


sum += array[i];


prod *= array[i];





if (array[i] %26gt; largest)


{


largest = array[i];


}





if (array[i] %26lt; smallest)


{


smallest = array[i];


}


}





printf("Sum is %d\n",sum);





avg = sum / 3;


printf("Average is %d\n",avg);





printf("Product is %d\n",prod);





printf("Smallest is %d\n", smallest);


printf("Largest is %d\n", largest);





}


C Programming "for" statement?

hi folks


write a c program that will accept 10 integers("99, 80, 50.. something like that...that ranged from 1-100 only, then the machine should determine the value if it is divisible by 3 or not, the program should also determine how many integers were divisible by 3 use for statement.





here's what ive done please help me continue it hehe


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


main()


{


int a,b,c;


clrscr();


printf("Divisible or not divisible by 3");


printf("Input an integer: ");


scanf("%d", a);


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

C Programming "for" statement?
#include %26lt;stdio.h%26gt;


main()


{


int a[10], i, count;


count=0;


clrscr();


printf("Divisible or not divisible by 3");


printf("Input 10 integers: ");


for (i=0;i%26lt;10;i++)


{


scanf("%d", a[i]);


while(a[i]%26lt;=0 || a[i] %26gt;=100)


{


printf("Please enter number 1-100 only\n");


scanf("%d", a[i]);


}


}


for(i=0;i%26lt;10;a++)


{


if(a[i]%3==0)


{


printf("%d is divisble by 3\n", a[i]);


count++;


}


else


printf("%d is divisble by 3\n", a[i]);


}


printf("%d numbers are divisble by 3", count);
Reply:just looking at yours and the 1st answer, scanf()


requires an %26amp;.. scanf("%d",%26amp;a) or scanf("%d",%26amp;a[i])

flowering plum

I have a doubt regarding c++ program?

frenz...i'm a beginner in c++ programming...i wrote a sample program which goes as..


// sample program


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


main()


{


cout%26lt;%26lt;"welcome to c++ programming";


}





i compiled dis program n' it says


FATAL.....\INCLUDE\IOSTREM.H22:unable to create output file 'C:\TC\OUTPUT\NONAME.01.obj'





wht does this mean...n' hw can i rectify dis mistake?

I have a doubt regarding c++ program?
you have to 1st create a main with a variable, which can be:


void, int, bool, double, float





so to cut out some work, I use void main()





you left out:





after the '#include...' line 'using namespace std;'


you left out a return variable for main (to cut out the work I would put 'void main()')
Reply:read links...below hope this will help





S.T.
Reply:#include%26lt;iostream%26gt;





using namespace std;





int main()


{


cout%26lt;%26lt;"welcome to c++ programming";


return 0;


}





Write this code . I think this will solve the problem. And always write the code the way shown.





1. Don't use .h after any C++ header file


2. Always write the line "using namespace std;" after all "#include%26lt;...%26gt;" statements are complete.


3. int before main()


4. return 0 before "}"
Reply:edit your code to look like this:





#include %26lt;iostream%26gt;





using std::cout





int main()


{


cout %26lt;%26lt; "welcome to c++ programming";


return 0;


}


Which of the following includes all the others?a,b,c,d?

a.hybridization


b.inbreeding


c.selective breeding


d.induced mutations

Which of the following includes all the others?a,b,c,d?
D.?
Reply:I would go with C myself.





Selective breeding can include inbreeding, can be used to try to induce mutations and it is used for generating hybrids.
Reply:I'd go with C.


C++ : convert time from seconds to Hours, Mins and Seconds?

how do i convert time from seconds to HH:MM:SS in c++?





I'm can only use these libraries


#include%26lt;iostream%26gt;


#include%26lt;string%26gt;


#include%26lt;iomanip%26gt;


#include%26lt;cmath%26gt;





how would you calculate it mathematically? and how should i implement it in C++?

C++ : convert time from seconds to Hours, Mins and Seconds?
void main()


{


int time,hour,min,sec;


cout%26lt;%26lt;"Enter time in seconds :";


cin%26gt;%26gt;time;


hour=time/3600;


time=time%3600;


min=time/60;


time=time%60;


sec=time;


cout%26lt;%26lt;"\n\nThe time is : "%26lt;%26lt;hour%26lt;%26lt;"::"%26lt;%26lt;min%26lt;%26lt;"::"%26lt;%26lt;sec;


}





for this program, you just need iostream.h


Turbo C++ experts!?!?!?

here is my source code and i need to have these:


1.pascal triagnle of a certain degree n (x+y)^n


2.specific line of pascal triangle of a certain n (x+y)^n


3.Rth term coefficient of pascal triangle (ax+by)^n


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





int main()


{


int row,c,n,x;


void pasc(int);





printf("\n\nEnter the no. of rows: ");


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





printf("\n\n\n");


printf("\nPascal's triangle :\n\n\n");





for(n=0;n%26lt;row;n++)


{


for(c=row-n;c%26gt;=0;c--)


printf(" ");


pasc(n);


printf("\n\n");


}


}





void pasc(int n)


{


int r;


long fact(int);





for(r=0;r%26lt;=n;r++)


printf("%3ld ",fact(n)/(fact(n-r)*fact(r)))...


}





long fact(int v)


{


if(v==1||v==0)


return(1);


else


return(v*fact(v-1));


}








thanks a lot!!


love lots!!!

Turbo C++ experts!?!?!?
Richard this link will help you





http://www.cpp4u.com/c++/source_code/res...

nil

For the following C-program, does it mean it prefers to be in the state of "not inspace" or putting out chars?

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





int main(void)


{


int c;


int inspace;





inspace = 1;


while ((c = getchar()) != EOF)


{


if (c == ' ' || c == '\t' || c == '\n')


{


if (inspace == 0)


{


inspace = 1;


putchar('\n');


}


/* else, don't print anything */


}


else


{


inspace = 0;


putchar(c);


}


}





return 0;


}

For the following C-program, does it mean it prefers to be in the state of "not inspace" or putting out chars?
There is no preference in the software - that concept doesn't apply.





What the program does is to replace white space (1 or more of space, tab or newline) and replace it with a single new line. In other words, the software will copy each word of the input on its own line in the output.


What should be included when updating a resume or C.V.?

I'm under a certain amount of pressure to one day rejoin the workforce! Should I include things that aren't specific to the employment I seek for example my working as an independant astronaut with over three thousand hours of flight time logged, Ocean going iceberg racer Captain; or being a crack marksman with a potato gun at five hundred yards? I'm looking for work in the food service industry or vegetable gathering industry. Would it be better to list my sheer delight in bussing tables for the morbidly obese or how much I love to listen to People complain about their underdone baked potatoes even though I'm not the cook and can't do anything about that? Your help would be most welcome, thank You in advance!

What should be included when updating a resume or C.V.?
ah so you are out of work as well I've just updated my CV in the hope of getting better work my list includes Axe murders ,upsetting Christians [all the time ],scaring kids on Halloween ,lying cheating and swindling


the only two offers i got were to go into politics or become a lawyer


but hey you have to draw the line somewhere and even i haven't sunk that low yet
Reply:what no beating up old ladies? no swiping candy from children? those are musts if you want a prestigious job in food service as well as the following -


must be a non bather, a nice cat litter scent mixed in with your clothes is also good.





also must like to play with your hair, pick your nose, scratch in unmentionable places and yet manage not to wash your hands between any of these tasks.





if you can manage the above skills you might be ready for an entry level position in your nearest fast food restraunt.
Reply:You should became a hobo instead
Reply:Don't forget to put your short-lived stint as a basset hound trainer...those Gnomes really thought you did a good job!


Can any1 give me standard procedure for calling java method from "c++" using vc++?

basically it invovles invoking JVM....


i tried but got errors !


i tried as follows =%26gt;


created .java ,.class,.h files using javac,javah cmds.


opened vc++ =%26gt; win32 appl'n %26gt; c++ file as source


program is @ sun site JNI specification book ! invocation api's chapter...simple hello world program...


then i set paths of library at file jvm.lib.


set the preprocessor path to jni.h means C:\j2sdk1.4.2_05\include


and run ....


gives many errors linking error like


Linking...


LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16


Debug/ltry.exe : fatal error LNK1120: 1 unresolved externals


Error executing link.exe.


ltry.exe - 2 error(s), 0 warning(s)





sometimes gives error C:\ltry\tr.cpp(18) : warning C4129: 'j' : unrecognized character escape sequence


in code @


options[0].optionString="-Djava.class....





can any1 tell me valid procedure ?


do u hav anyother gud book for invocation api's?


Thanks Amit

Can any1 give me standard procedure for calling java method from "c++" using vc++?
I dont know what the probelm is but it does work when i refer


the docs.





But the procedure will br something like


1. Create a JVM Instance


2. Create an object of the Java Class


3. Call the Method.





The Names will be something like


Java_ClassName_MethodName( Para List );


Using regular expressions with C++?

If you have a string of text:





string SampleText = "12345 quick 12345 brown 12345 fox";





and you wanted to use a regular expression to identify the words in the SampleText (a word is defined as a group of letters not separated by a space), what is the c++ code that would do it? What #include statements would I need?





Complete code would be helpful, but any help is appreciated.

Using regular expressions with C++?
If you are using unix:





you can use %26lt;regex.h%26gt;


Posix function are: regcomp, ergexec, and regerror.





you can type 'man regcomp' to get an explanation of how to use the functions.





If you are using Windows, here is some sample code:





// regex_parse.cpp


// compile with: /clr


#using %26lt;system.dll%26gt;





using namespace System;


using namespace System::Text::RegularExpressions;





int main( )


{


int words = 0;


String^ pattern = "[a-zA-Z]*";


Console::WriteLine( "pattern : '{0}'", pattern );


Regex^ regex = gcnew Regex( pattern );





String^ line = "one\ttwo three:four,five six seven";


Console::WriteLine( "text : '{0}'", line );


for( Match^ match = regex-%26gt;Match( line );


match-%26gt;Success; match = match-%26gt;NextMatch( ) )


{


if( match-%26gt;Value-%26gt;Length %26gt; 0 )


{


words++;


Console::WriteLine( "{0}", match-%26gt;Value );


}


}


Console::WriteLine( "Number of Words : {0}", words );





return 0;


}





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


Note, the using namespace statement up top ends in: RegularExpressions;


The ... is a yahoo answers problem.

sp