Friday, July 31, 2009

Error in C program ?

I am using this program to calculate the no. of notes of denomination 10,50%26amp;100 in a given amount but i am getting error as soon as i enter the amount ?





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


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





main ()


{


int a,b,c,a1,b1,c1;


int p;





printf ("enter the amount to be withdrawn Rs p \n");





scanf(" %d",p);





a=10;


b=50;


c=100;








a1= p-(b+c)/a;


b1= p-(a+c)/b;


c1= p-(a+b)/c;











printf("the number of notes of type a1 = %d",a1);


printf("\n");


printf("the number of notes of type b1 = %d",b1);


printf("\n");


printf("the number of notes of type c1 = %d",c1);


getch();





}








What is the error , it compiles the prog successfully but after that shows error

Error in C program ?
// This is what the line should look like





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

radiata

Why i cant run my C on my vista PC properly?

i am trying to do programming in C ,but it gives me erroe named include file not loaded. why it is so?


i have windows vista OS and intel core 2 duo processor.


it do not allow even a simple hello wold program.


is there any alternative software to run C programs on this system?

Why i cant run my C on my vista PC properly?
I am not comfortable with my answer, but this is my best short. You are trying to run a C Program in a C++ Compiler.





Then you need to include the line at the top of the program





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


void main()


{


printf("Hellow World !");


}





The Diff between C and C++ is that you need to include STDIO.H and use Void Main instead of Main.





Hope this will fix your issue.





For more blogs on technology check my blog http://cybergurus.wordpress.com
Reply:in vista high security and new ,,therefore in this O/S few- lower version will not support.. and if u r using original anti virus in ur COMP then don't use piracy vista ,, if u r using disable / turn off all automatic updates.. original anti virus will enable automatically from background ur all option of security and will send windows product key to Microsoft.. then ur computer will get slow.. windows file link will break..u will get error message..


i hope u will under stand..


in this vista few- lower version will not allow.


rhtkapur@yahoo.co.in
Reply:because vista sucks,go back to XP


How do I correct failure notices including mailer-daemon@yahoo.c?

failure notice occurs when i send an e-mail to a specific account. At times the message goes through, other times i get this failure notice...how do i correct??? what am i doing wrong? Is the problem on my end or the recipient's???

How do I correct failure notices including mailer-daemon@yahoo.c?
the mailer-daemon@yahoo.com will send you an email when yahoo cannot deliver the message to the desired recipient. a few reasons explain this:





1) wrong email address


2) the email address doesnt exist anymore (ie removed or deleted)


3) the server that collects the email for that address is down





if you are sure that the email address is correct (recheck just to make sure) then the problem is most likely on the recipients end
Reply:could be server is too busy or sometimes you just enter the email adress wrong.
Reply:your saying it goes through at times.could be their mailbox is full or you cannot hit forward to send to that address.My daughters work is like that .I have to compose a new message every time.


Wierd freeing up space- used space 58GB. When selecting all files in c drive 16GB?

My HD is 80GB with 69.99Gb available, I have 10GB available now. I dont have any unnecessary file just 4-5 GB of music. I have low disk space problem. I only have C dirve in my comp no additional partition. When i select all files in c drive its about 16Gb (including all system files and hidden files) however disk spaces used is 58GB. IDK why is it reporting wrong. I deleted all temp files/recycle bin/Internet temp file. Any suggestions how to clear up more space.

Wierd freeing up space- used space 58GB. When selecting all files in c drive 16GB?
Go to My Computer. Right-click C. Then select 'properties'. It should tell you how much HD-space is free.





Know that C doesn't hold everything that your computer has. My Documents and stuff like that could be taking up space, too.





Try restarting. Alot of times, that works for me. Sometimes it's just HUGE (I'm talking about 2 gigs each, and they leave several) temporary files left behind by programs such as PGP, or even Microsoft Office, to a lesser extent.





If not, run Disk Defragmenter- Start, Accessories, System/Admin Tools, then select that, and click run.
Reply:uh its probably just lying and you can add more than it says. or there are hidden folders you need to delete.
Reply:You may have a lot of applications installed. Try removing unnecessary applications to free up space. Also, the best way to tell how much space you have is by opening My Computer, right clicking C drive and selecting properties. Selecting all files does not really work for telling how much space is used.


Helping with C++ program to compare the value of two letters. please!?

The Question: What does the following statement print?(All variable are of type int.)





- this is in Visual C++ as well





My code so far:





#include %26lt;iostream%26gt;


using namespace std;





int main ()





{


int j;


int k;





if(j %26lt; k)





if (k %26lt; j)


cout %26lt;%26lt;1;


else


cout %26lt;%26lt;2;





else


if (j %26lt; k)


cout %26lt;%26lt; 3;


else


cout %26lt;%26lt;4;





return 0;


}





It keeps returning to me initialized local variables for j and k. When I use char j and char k, it works fine, but I have to compare them as int. It should print 2 if j %26lt; k and 4 otherwise...





Any help please? I have searched around and can't find anything.





Thank you!








In C++ each letter has a numerical value that goes with it, ex j = 56 and k = 57. So my program needs to compare the letters as integers(to compare there numerical value to see which is larger). but I am not supposed to set there values, and I am not supposed to use type char. Does anyone have any idea?





Thanks in advance.

Helping with C++ program to compare the value of two letters. please!?
The cin fstream object only accepts a character array, so cast them as characters frist. Once they're read from the stream, cast them as numerical then compare.





if ((float)j %26lt; (float)k)


{


cout%26lt;%26lt;3;


}


else


{


cout%26lt;%26lt;4;


}

medium

What do you think of "Mere Chrisianity" by C.S. Lewis ch. 1 (link included)?

www.philosophyforlife.com/mctoc.htm


(entire book is online to read if you want to)


I have only read the first 2 chapters...but it seems like an interesting book.


C.S. Lewis started out as an aetheist then he converted to Christianity...while he was at Oxford University he wrote this book...so he understood both sides to a degree, and has some interesting points, I think.


But since it is a long book...what do you think of just ch. 1 (for now)...(it is fairly short if you are considering whether to read it or not)

What do you think of "Mere Chrisianity" by C.S. Lewis ch. 1 (link included)?
I read the whole thing but it's been a while.





I think it's a good book. He presents many arguments against Christianity and then defeats them. He goes into the abstract, but not too far that his readers (or his listeners, as the case was when he was on the radio) can't follow him. I think it's a must-read for all Christians, especially those who don't understand much about their faith.
Reply:"While intellectually the young Lewis was an atheist, Lewis later described his young self ( in Surprised by Joy) as being "very angry with God for not existing"."





Sorry, but that's not an atheist. If I called myself a christian but didn't start believing in god or jesus, am I actually a christian?
Reply:I haven't read it. But it seems pointless to discuss whether or not Christianity is true if you don't first prove that god even exists. What proof does he provide for that?
Reply:Amazing book, but just a side note: Mere Christianity is a collection of radio talks that C.S. Lewis gave during WWII. He didn't write it during his time at Oxford, but that is where he became a Christian from being an atheist.
Reply:His entire premise is that there is some unifying morality that proves that a divine source gave morality to humanity. At the time, it was not understood how altruism could happen under evolution, and therefore, it could be confusing that many cultures shared certain aspects of morality.





However, his claim that most moral systems were in near agreement was and remains patently false, so his entire arguement falls apart.


Why it is included that VB.NET,C#.NET etc in visual studio.net what are the differences among those languages

VB = Visual Basic





C# = C Sharp





Visual Basic and C Sharp are both high level programming languages. The .NET versions take advantage of the .NET framework from MS. One of the biggest differences is that with C# you can actual do low level buffering and have to take into account buffer over runs. This means you could actually have data over write part of your executable code while running. Visual basic will not let you do this.


The products of a combustion reaction do NOT include___.?

The products of a combustion reaction do NOT include___.


a. hydrogen


b. carbon dioxide


c. water


d. carbon monoxide

The products of a combustion reaction do NOT include___.?
Hydrogen
Reply:water. Carbon dioxide and monoxide is a gas produced by burning. Hydrogen is present in air and is flamable.


The products of a combustion reaction do NOT include____.?

The products of a combustion reaction do NOT include____.


a)water


b)carbon monoxide


c)hydrogen


d)carbon dioxide

The products of a combustion reaction do NOT include____.?
hydrogen
Reply:the product of a combustion reaction that DOESN'T EXIST would be hydrogen

cvs

Need help with io in C++, have read much programmed little?

I am somewhat familiar with input/output in programming, but am having problems using file io in C++. This is my skeleton type program:





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


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


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


{ ifstream filein; ofstream fileout; char ch;


filein.open("input.txt", ios::in);


fileout.open("output.txt", ios::out);


for(filein.get(ch); ch!=EOF; filein.get(ch));


{


fileout.put(ch);


}


filein.close();


fileout.close();


return 0;


}





i created a text file input.txt and output.txt, input has "asd" in it and output is empty, i want it to write the asd to output.txt





using EOF it is infinite loop, and using NULL it terminates doing nothing, I have read a lot about c/c++ but this is my first stab at programming in it and it is taking me forever to get all syntax and small stuff takin care of. Please tell me what I am doing wrong. Thank you :)

Need help with io in C++, have read much programmed little?
http://www.cplusplus.com/doc/tutorial/fi...





Please get a better book. The above code is terrible. And outdated.





Just open up two filestreams and transfer one line to another. Use getline to take in entire lines. Store them in strings. As in %26lt;string%26gt; strings.





EDIT: I'll give you the code. Please get a newer book so you understand what I did.





#include %26lt;iostream%26gt;


#include %26lt;fstream%26gt;


#include %26lt;string%26gt;


using namespace std;





int main()


{


string str;


ifstream infile("input.txt");


ofstream outfile("output.txt");


if (infile.is_open())


{


while (!infile.eof() )


{


getline(infile, str);


outfile %26lt;%26lt; str %26lt;%26lt; endl;


}


infile.close();


outfile.close();


}





else cout %26lt;%26lt; "Unable to open file";





return 0;


}
Reply:use ifstream::in and ifstream::out instead!


Does anyone know the lyrics for pill poppin animal, I can only find rick ross' lyrics not triple c's?

Every website i try i can only find the first two versus that rick ross raps, but any version of the song i find is much longer then that and includes versus by triple c, does anyone know the lyrics to those versus?

Does anyone know the lyrics for pill poppin animal, I can only find rick ross' lyrics not triple c's?
i'm a pill poppin animal


syrup sippin *****


syrup syrup sippin *****


syrup syrup sippin *****





im a pill poppin animal


syrup sippin *****


im so high you could'nt reach me with a ****** antenna





im a pill poppin animal


syrup sippin *****


syrup syrup sippin *****


syrup syrup sippin *****





im a pill poppin animal


syrup sippin *****


im so high you could'nt reach me with a ****** antenna





feelin like a million bucks


fillin up a philly blunt


feelin on your *****


if you dont like it i dont give a ****


she know whats on my mind by the way a ***** look at her


she lookin at my watch if you dont like you should get you one


love to make her *** bounce just to get the dick hard


stickin on a double stack your rollin wit a rich boy


make it do tha helicopter ?????


tell it to the teleprompter you can tell em seven ???


fifty grand in dolla bills


call em ***** hollywood


time to make a movie


then its time to get up outta here


sittin on fours


sippin on gold


tussionex no ice but the leaves so cold


(I'm So High)


im a pill poppin animal


syrup sippin *****


syrup syrup sippin *****


syrup syrup sippin *****





im a pill poppin animal


syrup sippin *****


im so high you could'nt reach me with a ****** antenna





im a pill poppin animal


syrup sippin *****


syrup syrup sippin *****


syrup syrup sippin *****





im a pill poppin animal


syrup sippin *****


im so high you could'nt reach me with a ****** antenna


Washington D.C.- cheap, decent hotel?

I asked another question about D.C. yesterday and should have included this...What is a good hotel to stay at in D.C.? It would be good if it was close to all the attractions, but if you know of any that are significantly cheaper and a little further away we'd like to hear about those too! Thanks a lot!

Washington D.C.- cheap, decent hotel?
Hotels in DC are very expensive. If you are here on a weekend, you can often get a good price - but weekday prices can triple. Check the various bargain hotel web sites, but a couple budget options downtown are the hostel in DC, and the hotel Harrington. The Harrington has the huge advantage of having one of the best locations in DC, a couple blocks from white house and mall, and right by the Metro Center Metro station. Rates start under $100, which is unheard of in DC. They are basic, though, so it depends on what you consider decent. They don't have a lot of amenties, but are comfortable and clean.
Reply:At this site you can search hotels by location. It will get you the best deals as it searches all the deals from all the top booking sites. Good luck. Have fun, I've never been there:





http://www.hotelscombined.com?a_aid=781b...
Reply:when my school class and i went to dc, we went to the victorian suites.


C++ Header file question (SystemInfo.h)?

i am building a C++ console application that requires me to include "SystemInfo.h"


i included this in my project (ie...... #include "SystemInfo.h")


and i am getting a compile error with microsoft visual c++ compiler:


fatal error C1083: Cannot open include file: 'SystemInfo.h': No such file or directory





i did some research but cannot find this file or where it is supposed to be located, any help would be greatly appreciated!!!!

C++ Header file question (SystemInfo.h)?
Systeminfo.h is probably a system header file. Use %26lt; and %26gt; instead of quote marks. That causes the precompiler to look in the system directories first.
Reply:I used to get that error when I forgot to save the file I included in the program. I hope you the error. Good luck!

gardenia

Help with c program?

i want to accept some text from the user and print it character by character .i wrote the below program.it is working for a single word but when the user enters more than one word with space inbetween,the strlen() function ignores words after space.how can i determine the tota number of characters in the text








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


void main()


{


char c[400];


int d,i;


printf("enter text \n");


scanf("%s",c);


d=strlen(c);


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


{


printf("%c\n",c[i]);


}


getch();


}

Help with c program?
just modify ur scanf fn to like this





scanf("%[^ \n\t]s",c);





thats it.
Reply:for this you have change like below:


you have to use gets() function for more than one word











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


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


void main()


{


char c[400];


int d,i;


printf("enter text \n");


gets(c);


d=strlen(c);


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


{


printf("%c\n",c[i]);


}


getch();


}
Reply:scanf("%s", c) doesn't get all the characters inputted by the user... If it sees a "space", then scanning of characters is already stopped... In C, there is a function which gets all the characters including spaces (except for newline character since it is the cue ending the function), it is gets() probably under stdlib.h or string.h, just find it out...





Anyway, to use it, here's how:





int main()


{


char c[400];


gets(c); //On this part, the program waits for input until Enter is pressed...


int len = strlen(c); //get the length of the string through strlen();


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


{


printf("%c", c[i]\n);


}


getch();


}





That is how you do it... I hope it helped.. (^^,)
Reply:Why is the printf in a for loop take the for loop out and replace it with printf("%s",c) and see what that does


been a while since I've done simple dos output like that but is should work
Reply:yaa dear I understand the Problem you select the data type Char with array. but u get data with Scan f who only get value before spce. U replace the Scan f Function with gets() functio which means get strings it take all the charachter with Spaces. ok.


RVs include:?

RVs include:





A. motorhomes


B. tractor trailers


C. campers


D. all of the above


E. only a %26amp; c

RVs include:?
I drove a tractor trailer and believe me, it is not a recreational vehicle! It does have certain amenities such as two bunks, refrigerator, and a TV, but it is a commercial vehicle used for work and not pleasure so the correct answer is E. Only a %26amp; c.
Reply:yea, aA%26amp; C
Reply:D





RV stands for..Recreational Vehicle, so there for, motorhomes, travel trailers AND campers all fall under that catagory of RV
Reply:e


Including audio in a C++ file??

can any1 write me a simple code for including(importing or watever) a .wav or any odr format sound file and play it on d running of d program automatically??? pls help urgently

Including audio in a C++ file??
What you can do is issue a call to MCI to handle the audio file.
Reply:Uh, for which operating system? If it's DOS, then you have to search for pre-built libraries for sound and music, then run your program in DOS BOX (DOS emulator program). Back then, you had to program sound cards directly and build you own sound/music engines if you didn't want to purchase one.





For Windows, if you're using a framework like Borland's VCL or Microsoft's MFC, then you'll have to look in your framework's reference files to find the sound/music playing functions.


If you're programming with the Windows API, you can use different multimedia functions. For playing .wav files, you can use the sndPlaySound() function. For simple playback of .wav %26amp; other types of sound/music files, you can either use the MCI or DirectShow functions. MCI is older and most people use DirectShow nowadays, but MCI is simpler to use.





Example of mciSendString() function to play a MIDI file:


mciSendString( "play c:\midi\myfile.mid",0 ,0, 0);


http://msdn2.microsoft.com/en-us/library...


C++ biginner plz help.....?

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


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


void main()





{


float c;


c=400*400/400;


cout%26lt;%26lt;"output is "%26lt;%26lt;c;


getch();


}





ouput = 72





why not : 400

C++ biginner plz help.....?
I have the answer.





You should change the numbers to be "400.0" instead of "400". This is your primary problem.





The deeper reason that this is happening is that 400*400/400 is an INTEGER expression. It will be evaluated as an integer, and only assigned to a floating point result.





I believe that your compiler is a 16 bit compiler, this is the only answer that makes sense.





Now let's just see what the compiler is doing. Its first step is to evaluate 400*400. Now if you get out your calculator, you will get the answer 160,000. NOT SO FAST!!!! An integer in your compiler is only 16 bits long, and can only express numbers between -32768 and 32767. The answer that it comes up with is 28,928 (160,000 - 2*65,536). It will next divide 28,928 by 400 to give 72 (again it drops the fractional result because it is integer).





In both C and C++, the result of an integer expression is an integer. It does not matter if it gets assigned to a float or not. If you want float accuracy, then the numbers in the expression must be floats.
Reply:Sorry, it must be 400. '400*400/400' is an integer expression and evaluated as such. It is only changed to floating point when assigning the value to your float variable.





Do double check.
Reply:try to make : c= (400*400)/400;
Reply:please check by compiling again. it gives 400 on compilation.
Reply:i'm a biginner too but why do not initiate c with zero. try! and if is'nt that the problem don't bother me, please

aster

I need help with the U.C application?

I'm using my cousins account, but please help me...i know she'll have my neck, but help me......i don't get the bubble in thing for each school, since i'm applying online..it's for majors, and there are just too many of them, and i don't know what to do..i think i'm beginning to panic...I don't know my major, and there are just no end to the list...do i choose one or do i choose one for each section.....this includes all the U.C's......I'm goin crazy.... AND HOW DO I SAVE MY APPLICATION SO I CAN FINISH IT LATER HERE ONLINE%26gt;......

I need help with the U.C application?
Before you lose it completely, talk to a counselor and figue out a major.


Do I need a $7000 plus new A/C/Heating System?

We just bought a house with so-called appliance insurance. This summer temp was up to 100 and my A/C can only keep inside temp as 80. so, I called a service company come to take a look. After inspection, the serviceman told me, I need a new unit, includes furnace. Reasons: A/C unit fan bearing is noisy causing fan could not chase heat out of condensor faster enough, thus, compressor is circulating liquid back to the system. And, that is why, I don't get cool air. The technician did not say the system needs some freon(??). The furnace unit is in the attic, he said the fan is rocky and the unit is too old. Not just the unit cannot perform well, it is also dangerous to use since it will pump out CO during the usage. In conclusion, he recommended us to replace the whole unit and the unit will cost about $7000. I am a Mechnical Engineer, the A/C fan bearing sound good to me, the furnace fan also rotating w/o noise. The unit is made in 1996. Do I really need a new unit?

Do I need a $7000 plus new A/C/Heating System?
Call a different service company, you are getting ripped off. The only CO problem you will have is if the firebox having holes allowing the CO to escape into the house, or the exhaust flue being plugged allowing CO to back up into the house. Fan bearings can be replaced, As well as the entire fan cage if required, and the cost should not be but a small fraction of what you are being quoted. Replacing the fan is a 2 hour job at most 3, and even $200 an hour flat rate only make $600 labor, another $300 for the fan unit, and even adding $100 for driving time, only comes to $1000. Leave that guy at the hitching post and make other calls quick.
Reply:i just replaced my furnace and a/c unit last year. my only advice to you is get several estimates from quality company's. don't settle on just price. a 11 year old furnace should really not have to be replaced already
Reply:I suppose you told the guy upfront that you have insurance that will pay for any repairs. $eems like he is trying to make $ome extra ca$h on that ba$i$. Get another opinion and don't let on that insurance will be paying for it, which BTW I would not have paid for myself. Quality appliances will last a long time (usually).
Reply:If you're a mechanical engineer, it might come to mind that perhaps you may need a bigger refrigeration unit for cooling, not necessarily a new unit. If your house is not insulated properly, it can be difficult to cool, or perhaps the original unit was under-specified for cost reasons.





The carbon monoxide issue must be addressed.


The statement that the unit can pump out CO during operation is true IF the heat exchanger is rusted out. Assuming you have gas heat, and if that IS the case, you should replace it.





Get a second opinion.


If CF2=CF2(g) --> 2C(g) + 4F(g) requires +2552KJmol, find the bond enthalpy of C=C.?

additional details given are:


Delta H formation of CF4 is -907kjmol


C(s)--%26gt;C(g) is +717kjmol


E(F-F) is +158kjmol


E(C-F) is +485kjmol





Could you include details on how to do it, i think it involves hess's cycle

If CF2=CF2(g) --%26gt; 2C(g) + 4F(g) requires +2552KJmol, find the bond enthalpy of C=C.?
This is a trick question, the answer is Bond. James Bond
Reply:Draw a diagram and apply Hess's Law
Reply:hess's cycle: the enthalpy is the same regardless the path you follow to reach the compounds, breaking or creating bonds, the final energy balance is the same so you have to sum or reduce energies to find out the formation energy of your compound.


I will not do it, I have to watch tv





http://en.wikipedia.org/wiki/Hess's_law


Can someone please help me with C++?

I am not getting the average on this program why? my output is 0. what do i have wrong? please be specific with an answer - i am just learning C++ thanx! this is my code:


#include %26lt;iostream%26gt;


#include %26lt;iomanip%26gt;





using std::cout;


using std::cin;


using std::endl;


using std::fixed;


using std::setprecision;








int main()


{


//declare variables


int section = 1;


int grades = 0;


double totalGrades = 0.0;


double average = 0.0;





while (section %26lt; 3)


{


cout %26lt;%26lt; "Grades for Section " %26lt;%26lt; section %26lt;%26lt; ": " ;


cin %26gt;%26gt; grades;





while (grades %26gt; 0)


{


average = totalGrades / section;





cout %26lt;%26lt; "Next grade for Section " %26lt;%26lt; section %26lt;%26lt; ": " ;


cin %26gt;%26gt; grades;


} //end while





cout %26lt;%26lt; endl %26lt;%26lt; "Section " %26lt;%26lt; section %26lt;%26lt; " Average: " %26lt;%26lt; totalGrades %26lt;%26lt; endl %26lt;%26lt; endl;





section += 1;





average = 0.0;


} //end while


cout %26lt;%26lt; "End of the program" %26lt;%26lt; endl;


} //end of main function

Can someone please help me with C++?
I am not sure I understand your question.
Reply:Travers N for the win. I agree.
Reply:You're not adding 'grades' to 'totalGrades'. Also, your average calculation is wrong -- it should be:





average = totalGrades / gradesRead;





Why would you divide the sum of grades by the section number??





Your inner loop should look like:





totalGrades = 0;


gradesRead = 0;


while (grades %26gt; 0) {


cout %26lt;%26lt; "Next grade for Section " %26lt;%26lt; section %26lt;%26lt; ":";


cin %26gt;%26gt; grades;





totalGrades += grades;


gradesRead++;


}





average = totalGrades / gradesRead;
Reply:Who knows what that is suppose to be doing.





But you only assign totalGrades at the first to 0.0 .





Then you try to do this


average = totalGrades / section





which doesn't make sense because you are 0/section? that doesn't help.

marigold

How to change from c to c++?

Please, can anyone help switch this to c++?


I will be very grateful!





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


/* Computes the length of Collatz sequences */


unsigned int step (unsigned int x)


{


if (x % 2 == 0)


{


return (x / 2);


}


else


{


return (3 * x + 1);


}


}





unsigned int nseq (unsigned int x0)


{


unsigned int i = 1, x;


if (x0 == 1 || x0 == 0)


return i;


x = step (x0);


while (x != 1 %26amp;%26amp; x != 0)


{


x = step (x);


i++;


}


return i;


}





int main (void)


{


unsigned int i, m = 0, im = 0;


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


{


unsigned int k = nseq (i);


if (k %26gt; m)


{


m = k;


im = i;


printf ("sequence length = %u for %u\n", m, im);


}


}


return 0;


}

How to change from c to c++?
if u know c++


then change few input output statement and techniques of programming
Reply:You have the pseudo code and the C code from this and other posts I see. You should be able to do this. Your degree will mean nothing if you dont know how to program! Now put your nose to the grind and learn!
Reply:Or else you may contact a C++ expert at websites like http://oktutorial.com/


Take a look at my C++ program and tell my why it doesnt work. whats wrong with my program?

This program should count the numbers from 1 to the num(input number), but it doesnt work properly. I use Dev-C++ compiler.





Here is my program:





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


#include %26lt;iostream%26gt;





using namespace std;


int main()


{


int i,num,sum;


i=0;


cout%26lt;%26lt;"Please enter a number : \n";


cin%26gt;%26gt;num;


cin.get();


for (int num,sum,i; i%26lt;num;)


{


sum=sum+i;


}


cout%26lt;%26lt;sum;


system("pause");


return sum;


}

Take a look at my C++ program and tell my why it doesnt work. whats wrong with my program?
Your problem is in your for loop.





for (int num,sum,i; i%26lt;num;)





In this statement, you are creating a variable that is called num that only exists in your for loop block. You do not need the variable num declared in your for loop.





What is happening is that you read input from the user, and store it in a variable called num. Later on however you create a new variable called num in the new context (your for loop) and this new value of num has a default value of 0. As soon as you create it in the for loop, you no longer have access to the num value that you read data into.





Change it to:


for (int sum,i; i%26lt;num;)
Reply:when using namespace std:


#include %26lt;cstdio%26gt;





int num, sum = 0;


no "i" since you will be redeclaring it inside the loop


remove cin.get();


remove i = 0;


for (int i = 1; i %26lt; num; i++) sum += i;
Reply:This statement:





for (int num,sum,i ... )





re-declares those variables and they are visible only in your for loop. They are different variables than those in your main function. This is called variable shadowing. You can remove that first part of the for loop statement altogether.
Reply:try:





cin%26lt;%26lt;"Please enter a number : \n";


cout%26gt;%26gt;num;


cout.get();


for (int num,sum,i; i%26lt;num;)


{


sum=sum+i;


}


cin%26lt;%26lt;sum;


Problem with a simple C program?

I'm writing a C program that reads the text in a file, and prints it to the screen in a formatted way. This is the code I have written:





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


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





int main()


{


char c;


FILE *book;


book=fopen("Tale.txt", "r");


fscanf(book, "%c", %26amp;c);


printf("%c", c);


while (fscanf(book, "%c", %26amp;c)!=EOF) {


printf("%c", c);


if (c=='.' || c==',' || c=='-') {


printf("\n"); }


}


printf("\n");


fclose(book);


system ("PAUSE");


return 0;


}





It works fine, but I wanted to take the fscanf inside the loop and have something like this:





while (c!=EOF) {


printf("%c", c);


if (c=='.' || c==',' || c=='-') {


printf("\n"); }


fscanf(book, "%c", %26amp;c);


}





But when I do this, the program doesn't stop at the end of the file, and keeps printing dots (the text in the file ends with a dot)





Can somebody tell me what's the problem here?

Problem with a simple C program?
Change to do/while construct since you're no longer checking the status of fscan():





fscanf(book, "%c", %26amp;c);


do {


printf("%c", c);


if (c=='.' || c==',' || c=='-') {


printf("\n"); }


while (fscanf(book, "%c", %26amp;c)!=EOF);


}
Reply:In your first bit of code, the test to see if you are at EOF is made using the return value of fscanf and not the value of the variable c.





fscanf returns the number of input items assigned so you could do something like:





int status = 1;





status = fscanf(...);


while( status )


{


:


:


status = fscanf(...)


}





You could also do:


while( !feof( book ) )


{


}





You will still need to do an initial scanf() before the while starts or you will have garbage as your first character out.
Reply:Your version that works is checking the return of fscanf, which is what you need to do to know when EOF is encountered.





Not sure what your were trying by putting fscanf inside the loop. What you should do is write it so you don't need two calls to fscanf. Something like this, if you want fscanf inside the loop:





int done = 0;


do {


if (fscanf(book,"%c",%26amp;c) != EOF) {


...


}


else done = 1;


} while (!done);





There are many ways you can set up the loop. The point is it's better to not treat the first character in the file as a special case.


Are you sick of republicans comparing Washington D.C. to Baghdad?

Do republicans base all their political views on denial?





yesterday deaths by violence:


Washington D.C. 1


Baghdad 185 (doesn't include unreported deaths)





Is every street sign on D.C. expressways riddled with bullet and shrapnel holes?


Do goats eat from burning trash lots in washington D.C.?


How many military checkpoints are there in D.C.?


Does the power grid stay operational more than 8 hours a day in D.C.?


Have you ever got stuck in a D.C. traffic jam so a bomb squad could clear an IED?

Are you sick of republicans comparing Washington D.C. to Baghdad?
Yes, I am sick of republicans comparing Washington to Baghdad. They are the ones who are so gung-ho on bringing a victory to America, yet they recognize that they are tearing the country apart. It shows their lack of respect to the American people. Also, by having them take a place of serious poverty and turmoil (Baghdad) and turning it into political propaganda, they are disrespecting the Iraqi people. Their comments are an insult to Americans, the whitehouse, and most importantly, the people whom are affected by the evils of war.
Reply:Not at all but we are sick of the liberal left wing hacks blaming America for everything, lying in the media, eroding our social fabric, being unsupportive in the war effort, and being unpatriotic jackals.
Reply:I've never heard that, oh an unreported deaths blame the Iraqis they've been doing for decades, read your history.
Reply:Nice try Libturd.. Comparing a country to a small area like washington DC. that makes a lot of sense to you doesn't it?
Reply:no, im sick of liberals refuring to iraq as vietnam
Reply:if you compare the violence it is about parallel, it is obvious you are dumb
Reply:I typically use Detroit for comparison

dracaena

I need to add a C file to an existing complex makefile.?

I have a complex makefile that compiles about 20 different C files/java files/etc.. I have to make a standalone tool using a C file but needs to be included in the makefile. I'm not the best with makefiles just need to know how to include this or some things to look for as to where to add it.





Thanks

I need to add a C file to an existing complex makefile.?
Just add the new target and dependancies.








myprog: myincludes.h





Each makefile is different so you may need more than that.
Reply:Some where there will be a list of the outputs of the make process and that section will probably be first and will be labeled "all:". Add your executable name to that list, the add the make command somewhere further down, anywhere.


In c++,why should be the size of char array(to store a string) should be one larger than the no of characters?

in c++,why is it necessary to include the null character while storing a string and in c it is not necessary..why..???

In c++,why should be the size of char array(to store a string) should be one larger than the no of characters?
The NULL character is the defined string terminator in C and C++ as used by all string functions in C and the string types in the Standard Template Library (STL) and the Microsoft Foundation Classes (MFC). If you do not account for the NULL character, which practically all string functions expect you to do, you can end up with a lot of problems.





In short, it is a language characteristic that has been around since the very beginning, so it's not something to really question but just do.
Reply:The null character must be accounted for because most of the output functions using character string will stop output on detecting a null character and also string copy functions will stop copying characters upon detecting a null character.


If there was no null character, there is no way to stop the output or copy function.--deepak
Reply:The null character must be accounted for because most of the output functions using character string will stop output on detecting a null character and also string copy functions will stop copying characters upon detecting a null character.


If there was no null character, there is no way to stop the output or copy function.

morning glory

Trouble in the header file pshpack.h in C during compilation.?

While compiling a C program to connect the front end C, with the MS-Access database, I get a FATAL error like this::





"" Fatal INCLUDE\PSHPACK.H 7 : Error Directive " 1 as alignment isn't supported by the compiler""





What is a fatal error?How do I rectify this error. I have a TURBO C/C++ compiler and I downloaded this include file %26lt;pshpack.h%26gt; only recently.

Trouble in the header file pshpack.h in C during compilation.?
A fatal error is any error that the compiler / linker /assembler has designated, internally or by an input switch, to stop creation of output files on. In other words, it is "fatal" to the process. These are usually big boo-boos.





In this case, I have little information to base an answer on. It would have been nice to know what version of the compiler, where the file was downloaded from and what it is touted to do and by who.





At a guess from what I see (including the error verbatim was very smart!), the code alignment is wrong and set at 1. Probably this relates to boundary alignments, which enter into the complex world of Windows file format options, such as PE(Packed Executable) files. I would hazard a guess that one of the following two things is happening.





1). Your version of Borland Turbo C / C++ is too old to have facilities to handle this type of boundary alignment as the library and header files need.





2). Your compiler is capable to handle this type of file alignment, but the automatic or default settings ( which are usually set to allow most compilations to be as painless as possible!) have been accidentally or intentionally changed to something non-compatible with the current project.





I hope that this gives some idea of the problems roots. When in doubt, investigate the documentation thoroughly. All advice is free and damn well worth it!


I have read every single book that V.C.Andrews has written including the ones that are written under her name?

and I get tired of waiting for the newest one to come out doese anyone know of anything else that I could read thats a lot like them. all I am looking for is maybe an author or a title of a book that I can read. any suggestions? please!? and thanks

I have read every single book that V.C.Andrews has written including the ones that are written under her name?
VC Andrews died in 1986 and her work has been carried on by ghostwriter Andrew Neiderman. He writes light horror and other fiction under his name too. If you like his works as VC Andrews, you might like his own writing too.





Someone suggested Judy Blume. If you get her young adult series, she's amazing. The teen books she writes are a bit too young for me, but I'm 35 and I love the young adult series she's written.
Reply:I got tired of read V.C. Andrews years ago when all she could seem to write about is brothers screwing sisters in the attic. Blah!





I personally steer well clear of anything in like genre.





Try a decent author like Patricia Cornwell, Anne Coulter, Jackie Collins, Mary Higgins Clark, Anne McCaffrey, Nora Roberts, Jean M. Auel, Laurell K. Hamilton and Catherine Cookson. They all write wonderful over the top, believable books.
Reply:I'm guessing your reading V.C. Andrews and your age is in the teen area.....(don't know which end). Try Judy Blume, not the Childrens books, but the teen / young adult.


C++ help please!?

I am not getting the average on this program why? my output is 0. what do i have wrong? please be specific with an answer - i am just learning C++ thanx! this is my code:


#include %26lt;iostream%26gt;


#include %26lt;iomanip%26gt;





using std::cout;


using std::cin;


using std::endl;


using std::fixed;


using std::setprecision;








int main()


{


//declare variables


int section = 1;


int gradesRead = 0;


int grades = 0;


double totalGrades = 0.0;


double average = 0.0;





while (section %26lt; 3)


{


cout %26lt;%26lt; "Grades for Section " %26lt;%26lt; section %26lt;%26lt; ": " ;


cin %26gt;%26gt; grades;





while (grades %26gt; 0)


{


average = totalGrades / gradesRead;





cout %26lt;%26lt; "Next grade for Section " %26lt;%26lt; section %26lt;%26lt; ": " ;


cin %26gt;%26gt; grades;


} //end while





cout %26lt;%26lt; endl %26lt;%26lt; "Section " %26lt;%26lt; section %26lt;%26lt; " Average: " %26lt;%26lt; totalGrades %26lt;%26lt; endl %26lt;%26lt; endl;





section += 1;





average = 0.0;


} //end while


cout %26lt;%26lt; "End of the program" %26lt;%26lt; endl;


} //end of main function

C++ help please!?
#include %26lt;iostream%26gt;





using namespace std;





int main()


{


//declare variables


int section = 1;


int gradesRead = 0;


int grades = 0;


double totalGrades = 0.0;


double average = 0.0;





while (section %26lt; 3){





cout %26lt;%26lt; "Grades for Section " %26lt;%26lt; section %26lt;%26lt; ": " ;


cin %26gt;%26gt; grades;








if( grades %26gt; 0 ){


float iRunningTotal = 0;





//read them in and store them (could use a running total)


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


cout %26lt;%26lt; "Next grade for Section " %26lt;%26lt; section %26lt;%26lt; ": " ;


cin %26gt;%26gt; gradesRead;





iRunningTotal += gradesRead;


}





average = iRunningTotal / (float)grades;


}





cout %26lt;%26lt; endl %26lt;%26lt; "Section " %26lt;%26lt; section %26lt;%26lt; " Average: " %26lt;%26lt; average %26lt;%26lt; endl %26lt;%26lt; endl;





section += 1;


average = 0.0;





} //end while





cout %26lt;%26lt; "End of the program" %26lt;%26lt; endl;


}
Reply:I believe the answer to your problem is that you declare totalGrades to be zero at the beginning of the program, and you never change that value, or have the user change that value. you also declare gradesRead as zero. If you are not a big math person, zero divided by anything, is zero, and anything divided by zero is undefined. also, zero devided by zero is not zero, nor is it undefined: it is undetermined. you must have the user changed both of those values to something other than zero. Also, what is the difference between totalGrades, and grades? if there is a certain amount of tests that the user took, maybe ask for the grades one at a time?





e.g.: add these variables





double grade1;


double grade2;





while (grades %26gt; 0)


{


cout%26lt;%26lt;"What was the score on your first test? \n";


cin %26gt;%26gt; grade1;


cout%26lt;%26lt;"What was the score on your second test? \n";


cin%26gt;%26gt; grade2;





average = (grade1 + grade2) / 2





I'm not sure how much that helps or if that is even what your looking for, but good luck. Sorry, it has been a while since I have programmed in C++.
Reply:you calculate the average with this line:


average = totalGrades / gradesRead;





but then you assign the value of zero to average in this line:


average = 0.0;


Try commenting out this line and see what happens.


Is it possible to store more than 127 characters in a character array in C?

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


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


//Iinclude files...





// other functions





void main(int argc, char *argv)


{


char input;


//I tried input[] and input[200];


printf("Enter input");


scanf("%s",%26amp;input); // I also tried gets(%26amp;input)


/*


HERE FOLLOWS OTHER CODE


*/


}








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


Here lies the problem, I am unable to type more than 127 chars in the command prompt. I know it is long but i want it for some purpose.


I also once tried wheter it works if I initialize the string in the code itself. But that also didnt work.





Some more details:


Compiler : Turboc3,Turboc3


OS: XP Pro, 98SE


Ram: 256 MB





Is it not possible to store more than 128 ( including \0 ) chars in C?

Is it possible to store more than 127 characters in a character array in C?
You can store as many characters in an C array as you want.





Also I suggest you change to djgpp if you something similar to turbo c++. TUrbo C++ 3 is more or less dead and was ment for DOS only. Other alternates are VC 6, GCC on Linux, GCC using cygwin on windows.





There are some errors in the code you posted along with your question.





It should be





char input[1000];


gets(input);





and not gets(%26amp;input)


Same is the case with scanf





Since the name of an arrey itself is a pointer you need not send address of pointer.
Reply:yes, upgrad to/get a mac and you can have up to 1024*512*256*128*64*32*16*8*4*2*1 char's in a array

geranium

C progamming /clr?

I want to compile a program that I wrote in Microsoft Visual C++. It is a C program that looks like this:


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





int main()


{


if ( !remove("useless.txt"){


printf( "Remove Sucsess" );


}


return 0;


}





I just wanted to test the "remove" function that I recently learned.





When I try to complie it an error comes up:





1%26gt;cl : Command line error D8045 : cannot compile C file '.\remove.c' with the /clr option





Now I have no idea what /clr is can anyone help?


Is it jsut the compiler or my program?





Thanks,

C progamming /clr?
Your program is missing library...


set up libraries path...


Which programs are included in Visual Studio .Net 2005/2003?Can I run a Java/C++ program in it? How?

that is MS OFFICE contains


1. MS WORD


2.MS EXCEL


3.MS ACCESS


4.MS POWERPOINT





SO WHAT PROGRAMS ARE INCLUDED IN VS .NET 2003/2005?


HOW DO I RUN A C++/JAVA PROGRAM IN IT???

Which programs are included in Visual Studio .Net 2005/2003?Can I run a Java/C++ program in it? How?
in visual studioo you have





%26gt; visual c++*


%26gt; visual c#


%26gt; vissual basic


%26gt; asp.net


%26gt; mobile applications etc


%26gt; j# (microsoft version of java)*


you can run c++ and java usin visual studio


Better chance of getting job if you put your picture on your C.V?

Is it better to also include a picture, like a headshot, with your C.V and can you do that? Or do they prefer not to include your picture on the C.V?? I really want to increase my chances of getting a job! But are there some special rules that says you shouldn't? Thanks.

Better chance of getting job if you put your picture on your C.V?
It never made a difference to me. I focus on the skills and experience of the candidates and on their ability to interview. I don't think including or not including a picture on your CV would make any difference.
Reply:Don't include your photo.
Reply:Not a good idea !


I want to settle in edmonton , C.A.,need audit or import manager for garment importer directory website need

ISITHORE LOURDURATHINAM


Email: isithore@rediffmail.com or newmen@rediffmail.com


Dear


In the August of this year I will be permanently relocating to the Edmonton area. I am forwarding the attached resume for your evaluation because of my desire to contribute my comprehensive experience in the accounting and auditing field.


I have 12 years experience involving all aspects as a C.A can do. My responsibilities include range of activities ,noted in my resume.


My experience also include Accounting practice, book keeping, ERP implementation, system analyst for software development, internal audit, consultancy, inventory and stock audit, audit of Nationalised bank, taxation service etc.,


Thank you for your consideration.


Sincerely,


Isithore





OBJECTIVE


Seeking a challenging position in the field of Internal Audit /Cost Audit/ Book keeping/ERP Implementation Projects, where my practical work experience %26amp; education can be utilized. Also within an Organization which will allow me to implement all of my skills %26amp; experience, preferably in Accounting Firm or Knitted garment manufacturing/trading unit.


SKILLS SUMMARY


• Over Seven years experience as Cost auditor, as integral part of my audit practice profession.


• Practicing Chartered Accountant for 12years as F.C.A., under ICAI Act INDIA.


• Experienced working with software projects, as system analyst , consist of


 Flow chart preparation for each modules, Logic framing and Entry screen formats


 MIS Report designing


• For composite knitted garment large scale unit, and Aluminium industries.


• Knowledge of Knitted garment manufacturing system including costing and budgeting


• Computer skills with MS-Office, Tally Accounting Package, also using many tailor made packages and book keeping, internet.


• Equally effective working in management project and as a member of Team.


• Ability to motivate, support and train team members


• Ability to think open-mindedly and be creative evens in most routine of situations.


• Effective team worker with excellent initiation, co-ordination and motivational skills.


• Focusing and objective in my work approach with an attitude of getting the work done, especially under pressure.


• Possessing garment Merchandiing and Quality control Diploma





WORK HISTORY


Practicing Chartered Accountant: 1995 to Till Date


F.C.A under The Institute of Chartered Accountant Act as full time practitioner


As consultant %26amp; service provider in the following Field: -


• Income Tax, Sales Tax – Preparation, Finalization, Representation.


• Book keeping through various Accounting Packages


• System Analyst for software projects


• Cost auditor for Composite knitted garment industries %26amp; other manufacturing industries, on assignment basis.


• Arrangement of Financial Assistance for corporate and non-corporate from various Financial Institution.


• Installation of effective Internal Audit system for various industries %26amp; implementation of systems %26amp; training for audit team.


• ERP implementation contract on assignment basis, which consist of: -


 Installation of ERP Packages


 Selection of staff requirement from the unit


 Framing internal audit systems


 Training and evaluation of performance


 Conducting review meeting


 Framing corrective action


 Generating MIS reports


 Submission of MIS reports to top level management


 Removing operational conflicts


 Maintaining the ISO standards


EDUCATION


• Bachelor of Commerce from Madurai Kamaraj University


• Chartered Accountant from Institute of Chartered Accountant of India, New Delhi


• Diploma in Computer Application at Micro Computer Systems


PROFESSIONAL TRAINING


• Completed 200 hrs at various specialized seminars under Continuous Professional Education by Institute of Chartered Accountants of India.


• Attended various seminars by Taxation Authority


COMPUTER SKILLS


• Working knowledge of Ms-Office, Word, Excel %26amp; PowerPoint


• Tally Accounting Package, I

I want to settle in edmonton , C.A.,need audit or import manager for garment importer directory website need
Try Monster.com

sweet pea

Programming in Dev C++...Please Help?

I know C++ programming in Turbo C++.


But my same source codes from Turbo C++ are not working in Dev C++


Are the codes in Dev C++ different?





In turbo i wrote


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





but when i write the same thing in Dev C++ it jus doesn't accept it.

Programming in Dev C++...Please Help?
C++ libraries don't use .h anymore. Some compilers still support .h C++ includes, but most don't anymore.





Instead of





[code]


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


[/code]





You will have to use





[code]


#include %26lt;iostream%26gt;





using namespace std;


[/code]





If you don't know what a namespace is, you better google it, but to put it short, the C++ objects are into the std namespace, so you will have to either type that, or to type std:: before each object.





For example: std::cout %26lt;%26lt; "hello world";





(However as I said, "std::" is not necessary if you type "using namespace std;" in the start, becuase you tell the compiler the default namespace is std).








Other C++ includes are:


%26lt;vector%26gt; %26lt;string%26gt; %26lt;ctime%26gt; %26lt;cmath%26gt; (...)





As you can see, the names are the same, but without a .h and into the namespace std.
Reply:To see the output you could pause the program.


Try adding a "system("pause");" statement before the return.





Note that the function system() is basically Windows only. Report It

Reply:you can run your application through the DOS console:


go to start%26gt;run%26gt;cmd you will go to dos mode


then write the applicaiton name (ie. .exe), the result will be the following lines so no need to pause the system. Report It

Reply:Also instead of system("PAUSE"), you could put cin.get();





It makes you press enter to exit, and works good in Hello world, but if you want to create something that has input, I recommend using system("PAUSE"), its just that you never know if cin.get(); will work with input... Report It

Reply:It might accept





# include%26lt;iostream%26gt;
Reply:i have same problem can u help to find turbo C++ pls my ID is grubb128 now i'm online pls help me%26gt;%26gt;%26gt;


The fruits of grass species include.....multiple choice help?

The fruits of grass species include


a corn. b rice. c wheat. d all of the above





bio test help me quickly!!!

The fruits of grass species include.....multiple choice help?
All belongs to family poaceae





All of them are grass











to learn more about fruits


http://www.thefruitbook.com
Reply:D
Reply:i think just wheat
Reply:id guess all of the above


In turbo c++ ver.1.01 including a file iostream.h in program and compiling it show errors.so what should i do?

the program runs by using printf and scanf.

In turbo c++ ver.1.01 including a file iostream.h in program and compiling it show errors.so what should i do?
printf and scanf are not I/O stream members.. they are function of C library.. you need to include stdio.h





And.. please upgrade your compiler! it's not standard version!
Reply:sigh





if it shows errors, why don't you post them?? how are we supposed to fix errors if we don't know WHICH errors you have?
Reply:First check where in ur computer ur file (iostream.h) is.


It should be either in c:\tc or c:\tc\include.


Next start turboc ide. go to option


select directory.


set either tc or tc\include as found and then compile.


Hope it will help
Reply:Replace that turbo c++


install it again


The best possible way


I need C in five GCSEs including English, Maths and a science. to get on my course what counts as a science??

Biology, chemistry or physics.





..but if they're leniant you can sometimes push universities if you took physical education at A level, you can tell them you have knowledge of biology from that .. but you normally need one of those 3. :]

rose

Add c++ library?

I download a library containing a couple of .hh and .cc files like mylib.hh but i don't know in which folder i should paste the files so that i can use it.





and should i write #include%26lt;mylib%26gt; or #include "mylib.hh" in my c++ program?

Add c++ library?
if its a .h file you should #include "whatevs.h", if its a library within c++ its #include%26lt;iostream%26gt;


In Linux c programming, can we read a single charecter into a char variable without pressing enter key ?

I wrote the following program but I have to press enter key to get read the value into the variable.


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


main()


{


char c;


while(c!='n')


{


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


fflush(stdin);


printf("ok");


}


}


Is there any solution for this? Why?

In Linux c programming, can we read a single charecter into a char variable without pressing enter key ?
Use curses library. Its a wonderful library for exactly what you are looking for. Using this library you can handle keystrokes i.e. a char is trapped as soon as it is pressed, you dont have to wait for enter key press.





if curses.h is not availble in your machine, then re-run Linux setup, select custom libraries, there you will find ncurses library.





You get more info at:


http://www.gnu.org/software/ncurses/ncur...


http://www.unet.univie.ac.at/aix/aixprgg...


http://www.gmonline.demon.co.uk/cscene/C... -%26gt; great one to start off with





Good luck.
Reply:use the getch() function if you want to read a single char and not have it written to the console. If you want to read a char and have it written to the console then use getchar(). Neither function have any arguments to deal with and they only return characters from the keyboard, if either function returns zero it means that multiple keys have been pressed like Alt, if it dose return zero then you have to call the function again to find out what non-graphical keys were pressed. getch and getchar may not appear in your library of functions but it is in mine in the conio header.
Reply:Have you tried kbhit();


C ouple questions pictures included :]?

http://www.cmt.com/sitewide/assets/img/a...





do you like this hairstyle?


is it teenish looking


is it hard to style in your opinion?


is it out of style?


and im goin to get it cut that way at a saloon, but can u style it like that with a thin striaghtner or do u need to curl it?


thanks!

C ouple questions pictures included :]?
She looks like Marsha Brady from the Brady Bunch!
Reply:i like the style im 17 and it is in it is not to hard to do and a straightener and curling iron could do it
Reply:straighten it and flip it up at the ends.


rub some gel on your fingertips and use that to sorta


flip/bend them.
Reply:i think its much nicer if you keep it that long just striaghtened a bit will look perfect. i'm 32
Reply:hey, actually i like the style and all but it looks like its for ppl who are carrie underwoods age.....how bout this?





http://www.exposay.com/celebrity-photos/...
Reply:yes


yes


not really


no way!


i dont think so
Reply:i love it my friend just cut my hair like that the other day all i use is spray gel and my straightener
Reply:I like the style. but i looks like a 20 year old hairstyle. it isn't that hard to style it. It is in fashion (everybody has it). Nope you need to go to a salon to get it cute like that.


I need help with Microsoft visual C++ 2005......?

I am a newbie in programming, I am using Microsoft visual c++ express edition to learn the basics. I want to know the keywords for entering data and also the keyword for displaying result, (like the INPUT and PRINT in the old BASIC). I used cin and cout, but the program ended up having errors. It didn't accept the cin and cout keywords. I am trying to make a simple program to accept a value as input, do some mathematical operations and display the result.





This is my project





#include %26lt;iostream%26gt;


#include "stdafx.h"


#include %26lt;sstream%26gt;


#include %26lt;string%26gt;











int main()


{


int c;


cin %26gt;%26gt; c;


int total = c + 100;


cout %26lt;%26lt; total %26lt;%26lt; end1;


return 0;


)





Also a simple but detailed tutorial would be helpful. If you know any links please post it.

I need help with Microsoft visual C++ 2005......?
In between the lines:


#include %26lt;string%26gt;





int main()


Type the line:


using namespace std;





A namespace is just an organizational thing. Everything in the standard library of functions and such that come with the C++ language are defined inside a namespace called "std", which stands for "standard". Without that line you would've had to type something like:


std::cout %26lt;%26lt; total %26lt;%26lt; std::endl;


This isn't something you'll really have to worry about, just remember to include that line "using namespace std;" in your programs.





Also, the line:


cout %26lt;%26lt; total %26lt;%26lt; end1;


end1 should be endl (lowercase L)





endl stands for "end line".





Here's a tutorial I've used before:


http://www.cprogramming.com/tutorial.htm...

flowering plum

Can some one suggest me on this error. "in file included from main.c"?

In you main.c file you have include files (#include ...). This include files also have included files. Thoce included files may also include additional files.





The compiler has found an error while processing those included files.





The most likely reason is that you have included a file that assumes some other include file was already included.





Some times you can fix this by changing the order of the #includes in your main.c. If not you simply have to figure out what piece of information is needed.


How do i loop this program in C so that i can just start from the beginning again until i quit?

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


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





main ()


{


float c,f;





char menu_conv;


printf("Conversion Program!!!\n");


printf("Enter the type of source temperature by typing c or f: ");





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





if(menu_conv =='c' || menu_conv=='f')


{


switch(menu_conv)


{


case 'c':


printf("Enter a number in Celcius\n");


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


f= (9/5)* c+32;


printf("%f degrees celcius = %f degrees fahrenheit\n", c,f);


break;








case 'f':


printf("Enter a number in Fahrenheit\n");


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


c=(5/9)*(f-32);


printf("%f degrees fahrenheit = %f degrees celcius\n", f,c);


break;





default:


break;


}


}


else


{


printf("Invalid choice!\n");


}

















return 0;





}

How do i loop this program in C so that i can just start from the beginning again until i quit?
surround it whith a while








menu_conv='x';


// pressq to quit the loop.


while (menu_conv != 'q' ) {





//


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





if(menu_conv =='c' || menu_conv=='f')


{


switch(menu_conv)


{


case 'c':


printf("Enter a number in Celcius\n");


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


f= (9/5)* c+32;


printf("%f degrees celcius = %f degrees fahrenheit\n", c,f);


break;








case 'f':


printf("Enter a number in Fahrenheit\n");


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


c=(5/9)*(f-32);


printf("%f degrees fahrenheit = %f degrees celcius\n", f,c);


break;





default:


break;


}


}


else if (menu_conv != 'q')


{


printf("Invalid choice!\n");


}








}
Reply:i'll write it in C++ so you can change it to C


after the main define a while loop on a char like this


char x;


cin%26gt;%26gt;x; --%26gt; (input x)


while ( x != eof()) (if the value doesn't equal to the end of file)


{


(your program)


}


cin%26gt;%26gt;x; --%26gt; (input again)


} (end of main)
Reply:hey try this. i have made some changes and the changes are in capitals. good luck.





main ()


{


float c,f;


CHAR ANSWER;


char menu_conv;


ANSWER = 'Y'


WHILE (ANSWER)


{


printf("Conversion Program!!!\n");


printf("Enter the type of source temperature by typing c or f: ");





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





if(menu_conv =='c' || menu_conv=='f')


{


switch(menu_conv)


{


case 'c':


printf("Enter a number in Celcius\n");


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


f= (9/5)* c+32;


printf("%f degrees celcius = %f degrees fahrenheit\n", c,f);


break;





case 'f':


printf("Enter a number in Fahrenheit\n");


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


c=(5/9)*(f-32);


printf("%f degrees fahrenheit = %f degrees celcius\n", f,c);


break;





default:


break;


}/*END OF SWITCH*/


}?*END OF IF*/


else


{


printf("Invalid choice!\n");


}?*END OF ELSE*/





PRINTF ("PLEASE TYPE Y IF YOU WANT TO CONTINUE,ELSE TYPE N.\T");


SCANF("%C",%26amp;ANSWER);


}/*END WHILE LOOP*/


return 0;


}/*END OF MAIN*/


The C Programming Language book has something called EOF!?

An exercise with the end-of-file! That exercise is some program that mimics anything u put in





Here is the code of the program





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





main()


{


int c;


c = getchar();


while (c != EOF)


{


putchar(c);


c = getchar();


}


}





I do not understand this program! First of all, why does it have c = getchar 2 times???? second, what does that eof do??








Here, is my version of the same program:


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





main()


{


while(1)


{


char z;


z = getchar();


putchar(z);


}


}





It is shorter, it works the same! But my question is, I used char type variable??? why does it work when I put in multiple characters at once???


It should work only with one character! I am very confused!


Pls help me

The C Programming Language book has something called EOF!?
Hello,





1) With regard to the first code listing:





The first 'c = getchar()' is executed before the loop begins, while the second 'c = getchar()' is executed as part of the loop. EOF is a special integer value returned by getchar() to indicate that the stream has ended. In pseudocode:





read a value from the input stream


while the input stream has not ended:


  write the value to the output stream


  read a value from the input stream





This program will end when the input stream ends, or if it is terminated by Ctrl-C.





2) With regard to the second code listing:





There are several differences. First, by reading a char value rather than an int value, it is unable to detect the EOF condition. Also, by not checking for EOF, this loop will not terminate when the input stream ends. Finally, when EOF is read from the input stream, it will be written out to the output stream as though it is a valid character. In pseudocode:





infinitely repeat:


  read a value from the input stream


  write a value to the output stream





This program will only end when terminated by Ctrl-C.





Because a loop is used in both programs, they will process multiple characters until they terminate. The first program will run until you end the input stream (Ctrl-Z in DOS, Ctrl-D in Linux), or terminate (Ctrl-C). The second program will run until you terminate, and has undefined behavior if you end the input stream.





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


UPDATE


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





EOF is a constant defined in stdio.h, using "#define EOF (some number)"; it is most commonly -1. It is not technically a variable, though, so you cannot assign to it nor get its address. Typing "EOF" in your program is exactly the same as typing the number that is defined in stdio.h.





The following program always prints "-1" on my system. Try it out:





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





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


  printf("%d\n", EOF);


}
Reply:In the first example, it does the first getchar to check if there is even a value in it. if there is a value (ie it did not encounter an EOF) then the program proceeds.





In your program, you don't do a check for EOF. If you passed it an EOF, I assume it might break.
Reply:comeon yarr u r using d


while loop


dats why its wrkin wid multiple characters


nd eof is generally used wid files stream only
Reply:EOF means End Of File. Your code will loop until it encounter the end of the file you are reading chars from. If you are reading files from keyboard input, it won't work properly. That's why your code work... it reading keyboard input, not file input.
Reply:Hopefully you're developing on a UNIX or Linux platform, where you have the immensely useful 'man' utility at your disposal. From 'man getc':





RETURN VALUES





If successful, these routines return the next requested object from the stream. Character values are returned as an unsigned char converted to an int. If the stream is at end-of-file or a read error occurs, the rou-tines return EOF. The routines feof(3) and ferror(3) must be used to distinguish between end-of-file and error. If an error occurs, the global variable errno is set to indicate the error. The end-of-file condition is remembered, even on a terminal, and all subsequent attempts to read will return EOF until the condition is cleared with clearerr(3).





EOF is just a CPP macro defined to equal -1:





clay@olympus:~%26gt; grep EOF /usr/include/stdio.h


#define EOF (-1)





To simulate an EOF condition on a terminal, you can use Ctrl-Z (ASCII 26) in DOS/Windows or Ctrl-D (ASCII 4) in UNIX or Linux.
Reply:Second getchar() is used to pause execution of program. It was needed in some older compilers, if you don't use it than you don't have chance to view result.


Exactly how offensive is the "C" word to you?

My ex husband just left me a message calling me a c*nt. Most people, including me are more offended by that than anything else.

Exactly how offensive is the "C" word to you?
On average, yeah...it's about the most offensive word in the entire language. I've been called many names affectionately, that most would consider offensive, and yet didn't bother me at all. The c word is in its own category though. I don't think any amount of affection while using that word would be enough to make it acceptable to me.
Reply:I have only heard it used in very vulgar contexts, so, yes, it's offensive. I think there are things I'm more offended by, but in general, I'm offended by all words that are intended to hurt others or objectify them.
Reply:some men don't think with their head. they think with their 'other head' (DICK head).


*lol*
Reply:I HATE that word!
Reply:what a charmer. its the worst word that could be said. horrible
Reply:"cant" hmm doesnt seem offencive to me.... must be the way my head works
Reply:It is pretty high ranking offensively
Reply:It's degrading to women. It made me feel like he was insulting my womanhood- like I was wrong, ugly or stupid just for being a woman. I don't think guys see it like that, though. I think they just use the uglier words when they are at their maddest point. They'd say whatever comes to mind to get a big reaction. Don't take that from him! You are ONLY what YOU think you are.
Reply:I personally don't care if they call me a c*nt,the reason being that if a person has to resort to calling me names,i insist they call me something original.It shows a lack of creativity and intelligence on their part to resort to old insults.Therefore, it is I who am superior to them.Mwahahaha!


p.s. i've found a good response to that remark is 'I have one, therefore I am entiled to be one!'
Reply:Very offensive
Reply:I think it is a vulgar word and would never call anyone the word as a serious insult. Plus as I tell my husband when he uses it to describe something negative "A C*** is something that gives you lots of pleasure - don't imply it is a bad thing"!





I have (in a very joking manner) called my husband/ events the c-bomb word before - but only when I know that it is going to be taken in a jovial manner.
Reply:It rates up there pretty highly. It's about the worst non-cultural/racial slam available, but honestly, the only ones who use it are the ones who fit it most closely! haha. Glad to see you've moved on from that crowd. You should email me - guaranteed you won't get called *that* ;)


that's not even sugarcoatable!
Reply:its hilarious
Reply:simply answer this way


yes i have one and no you can't put your tongue on it!!


it is a offensive word but the more negative reaction you give him the more he's going to use it as gun fire!


p.s.if that doesn't work then call him a cu*t licker!
Reply:not at all, it is just a word

nil

Thursday, July 30, 2009

A substance has a specific heat heat capacity of 2.0 J/g.C', how many joules...?

A substance has a specific heat capacity of 2.0 J/g.C', how many joules are needed to raise the temperature of 30.0g of this substance by 15 degrees C?


do i need to include 15 degrees in the equation to solve?

A substance has a specific heat heat capacity of 2.0 J/g.C', how many joules...?
Specific heat capacity, also known simply as specific heat (Symbol: C or c) is the measure of the heat energy required to raise the temperature of a given amount of a substance by one degree. Commonly, the amount is specified by mass; for example, water has a mass-specific heat capacity of about 4184 joules per kelvin per kilogram. Volume-specific and molar-specific heat capacities are also used.





The equation relating heat energy to specific heat capacity, where the unit quantity is in terms of mass is:





Q = m c ΔT





Your substance has specific heat capacity of 2.0 J/(g*°C).





Q = 30.0 (m) * 2.0 (c) * 15 (ΔT) = 900 joules
Reply:. Q = MC ( t2 - t1)


Q= 30 g 2 JouLe/g.C^ (15-0)C^


Q= 60 (15) = 900 JouLes
Reply:Yes, the equation you need is:





Q = m * c * delta T





Where delta T is the temperature change. In this case, 15 degrees.





So...





Q = 30 g * 2 J/gC * 15 C


= 900 J





The units also work out. The C's cancel and the g's cancel leaving you only with J's, which is what you want.





Hope this helps!
Reply:You need to apply 2.0 Joules to heat each gram of the substance by one degree Celcius.





Amount of heat needed = 2 J/gC x 30g x 15C = 900J





So yes, you do need to include the 15 degrees C.


Note that the actual initial temperature is not relevant, only the change.
Reply:2*30*15=900 J
Reply:Energy = mass x heat capacity x (T2 - T1)





mass = 30.0 g


heat capacity = 2.0 Joules / g °C


T2-T1 = 15°C





u do the rest...
Reply:Yes. The equation needed for the problem is q = m * c * delta T


where q is the heat in joules


m is the mass


and delta T is the change in temperature
Reply:Yes, you do need the 15 degrees. I'll solve the whole problem for you.





Q = m.C.deltaT





Where


Q = Heat supplied(which is what we are looking for)


m = mass of object/substance


C = specific heat capacity


deltaT= change in temparature/ temparature difference





NOTE: Im using 'delta' which means 'change' because I cant find the symbol on my keyboard. But the symbol is a triangle before the T i.e. '(delta symbol/triangle)T' meaning change in temparature.





From the question, we are given;


m = 30.0g


C = 2.0J/g.'C


deltaT = 15'C


Q = ?





Since Q = m x C x deltaT





Q = 30.0g x 2.0J/g'C x 15'C.....i


= 900J..................................ii





On step i, the units g and 'C cancel out so that we remain with J (joules), which is the unit for heat/ energy.





The amount of heat(number of joules needed) is 900J.





Do this, there is no way you are getting it wrong
Reply:Q = (m)(delta T)(Cp)


Q = (30.0 g)(15 C - 0 C)(2.0 J/g.C)


Q = (30.0 g)(15 C)(2.0 J/g.C)


Q = 900 J


Account for significant digits


Q = 9.0 * 10^2 J