Sunday, August 2, 2009

I need a c++ program to convert Number to word form.?

Write a function that will convert a 5-digit (positive) number into word form.





Eg: 123, the output should be one hundred and twenty three...





(this should be a c++ program).

I need a c++ program to convert Number to word form.?
Very well, you need a program. What is your question? Do you want smbdy to do your homework for you?





%26gt; This is not my homework...


%26gt; This is the program i have to take for my seminar...





Oh, that makes a big difference, lol!





%26gt; i can't sit in front of my pc for long n work on this coz i have a lots of headache...





What about programming books? Can you read them? Can you write? This program is not large, you can always try to write it on paper - then you'll need just to type it, compile and run, it'll not take you much time. If you get any errors, write'em down, return back to your papers and analyze your code. Actually, that was the way programmers work in times "when computers were big" - this is not very quick way, but it helps to improve your programming much.
Reply:I can't give you the code, but here is how you do it.


First separate the digits: by taking the modulus(%) of the nuber by ten eg. no%10, do this in a loop. Get the answer in another variable t[4]; and subtract it from the main number ie. no=no-t[i];


I is the counter that increments with every loop;


In a charater variable sent[100];


Start with t[3]; and t[2] put it as as


cout%26lt;%26lt;t[3]*10+t[2] "thousand", print it.


go on like this till you come to 0;





Hope you can understand and this helps
Reply:Do your own homework.





But you can ask for help on a specific problem here:


http://cboard.cprogramming.com/


Can you help me with this C++ Program?

write a C++ program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate's name, the number of votes received, and the percentage of the total votes received by the candidate. The program should also output the winner of the election.





Using 3 functiions and some arrays

Can you help me with this C++ Program?
Hey, it's time to do your homework yourself.


There are numerous programmers here for whome this program is just 3-4 min. task (Including me).


But.......don't fool your teacher.....
Reply:Home work a little over your head? I could easily write this up in about 3 of 4 minutes but i doubt it would all fit here.





Try http://www.planet-source-code.com/ for some examples. they have 2 that i see that would do what you are asking just from a quick look. well.. you would have to check out each example since neither is an exact match. I suggest you just look for personal interest and not copy the code verbatim.
Reply:Right on Ashish Sharma.


Compile this following c++ program and tell me any compile issues and fix them (i'm in urgent with this quest)

compiler can be turboc2 or c3.....


the program is as follows:





#include"conio.h"


void main()


{


int gd=DETECT, gm;


initgraph(%26amp;gd, %26amp;gm, "c:/turboc3/");


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


{


circle(330,180,10*i);


delay(100);


}


getch();


closegraph();


restorecrtmode();


}

Compile this following c++ program and tell me any compile issues and fix them (i'm in urgent with this quest)
we need the header file conio.h to compile.





Also why can you not test this file yourself?

gift baskets

Write a simple C/C++ program which defines an array of five elements, then using pointer to display the addres

Write a simple C/C++ program which defines an array of five elements, then using pointer to display the addresses of all elements of the array.

Write a simple C/C++ program which defines an array of five elements, then using pointer to display the addres
#include %26lt;iostream%26gt;





using namespace std;





int main()


{


int array[5];


int* pointer = NULL;





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


{


pointer = %26amp;array[i];


cout %26lt;%26lt; "The address of element (" %26lt;%26lt; i + 1 %26lt;%26lt; ") is: ";


cout %26lt;%26lt; %26amp;(*pointer);


}


return 0;


}





// you can also do it without using a pointer as follows:





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


{


cout %26lt;%26lt; "The address of element (" %26lt;%26lt; i + 1 %26lt;%26lt; ") is: ";


cout %26lt;%26lt; %26amp;array[i];


}
Reply://C//or//C++


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


Start


Define: /Array


Elements: /5


Now use:


What?


pointer to address the F* display


what for?


elements of the display?


how many?


5!!!


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


end
Reply:Any other help me to solve that Question
Reply:/* Tolga's C code */





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


int main(){


int i=0, arr[5];





for(;i%26lt;5;i++)


printf("Address of the element #%d is %p\n",i,(arr+i));


return 0;}
Reply:dude, that's not even a program. that's like 5 lines of code, if even.
Reply:#include%26lt;iostream.h%26gt;


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





int main(){


int *p;


int a[5] = {1,2,3,4,5};





p = a; //simple assignment





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


cout%26lt;%26lt;(p+i);





return 0;


}
Reply:Do your own homework
Reply:Why dont you try your own Mind to Answer your Assignments, you are just sitting in your Campus to ask people to do Assignments for you, hmmmm








Very Bad Hafsa, Very Bad
Reply:/*-------hi dude: try this :its 100% right---------*/


/*-------it really takes something to learn pointers in c---*/


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


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


void main()


{


int a[5] = {1,2,3,4,5};


int *i;


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


{


printf("\t%d",*(a+i));


}


getch();


}


I need help w/ a C++ loop based program?

Windchillold = 0.081 x (3.71 x Öv + 5.81 - 0.25 x v) x (t - 91.4) + 91.4


Windchillnew = 35.74 + 0.6215 t - 35.75(v0.16) + 0.4275T(v0.16)





where v is the wind speed in MPH, and t is the temperature in Fahrenheit.





i need to write a C++ program that will create wind chill charts for a given temperature. the program should display the following menu to the user and prompts for his/her choice:


O: Display old wind chill index chart


N: Display new wind chill index chart


C: Compare old and new wind chill index charts





If the user enters 'o' or 'O', then the program should ask the user for a temperature (in degrees F) and then display the old wind chill values for wind speeds from 0 to 50 mph in increments of 5 mph. It is assumed that the user will enter a temperature value between –40 and 40.


If the user enters 'n' or 'N', then the program should ask the user for a temperature (in degrees F) and then display the new wind

I need help w/ a C++ loop based program?
I can only say so much because those equations are too long for two in the morning. Not that it matters; I just won't be retyping them. But you certainly need a bunch of random things for this. First, you need a variable -- a char, probably, since you don't care about any input beyond that. I don't know what the compare thing is going to output, but that'll come.





I suggest an array for the old and new charts.





Geez, what's the syntax? int oldchart[11], or something? I'm getting too used to Java. Anyway. Since you're going in increments of 5 from 0 to 50, you'll have a 0, 5, 10, ... 45, 50 -- that is, 11 different speeds, right? So you'll need an array for the old chart and an array for the new chart, both with a size of 11. Do you get where I'm going?





Calculating the chart takes a bit more thinking. We'll ignore the actual process of getting input for the moment and just deal with filling it in. I'll suggest a method, and explain afterwards:





int speed;


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


{


speed = i*5;


oldchart[i] = %26lt;calculate wind chill%26gt;;


}





The same thing could be applies to the newchart array. The index, i, will go from 0 to 10, matching the indexes of the array, right? Since you're going by increments of 5, the speed for slot i will be i*5. That takes you from 0 to 50.





So after you pull that off for the old and new, you've got charts saved in the variables. Printing them is kind of similar to what happened above -- you use a loop to output what's in the array, using i*5 for the speed.





Now, granted, you could combine this and the above step so you wouldn't need the arrays at all--you'd just recalculate and print every time. But I find it easier to organize my thoughts by going a way that deals with one issue at a time... It depends on what you prefer at this point.





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


{


speed = i*5;


cout %26lt;%26lt; "Speed: "%26lt;%26lt; speed %26lt;%26lt; " Wind Chill: " %26lt;%26lt; oldarray[i] %26lt;%26lt; endl;


}





Let's see...





Displaying the menu is easy--just use cout %26lt;%26lt; "your menu stuff" %26lt;%26lt; endl;


Input is a bit stranger, I think. For something like this, just use a cin and check afterwards if it's right. Um, let's see... I'll give this to you in pseudocode--you should be able to work out the actual stuff.





while ( the user doesn't want to exit )


//this is just a logic thing -- if the user is done, then what?


{


take the user's input;





if the input is 'o' or 'O'


{


calculate and print the old chart


}





else if the input is 'n' or 'N'


{


calculate and print the new chart


}





else if the input is 'c' or 'C'


{


calculate and print both the old and new charts (?) (whatever compare does)


}





else if the user wants to exit


{


end the program (usu. with return 0 or something of that nature)


}





else the user's input was bad


}





Mind that for this to go well, you'd have to mind a few issues -- as I wrote above, if the user doesn't enter what you expect them to. Also, you'd have to deal with a case where the user decided to print charts before entering data into the old or new charts. For that, you should give the temperature a default value, like 0, so the charts can still be calculated.





You can see that I wrote in a calculation for every print, which is what I was saying before with it not being necessary. You could technically use the for loop I gave for printing but just replace the reference to the array with the calculation for the wind chill.





...Don't know if I covered all of it, but I should be getting to bed. ^^;


What is a good program to use for C# programming?

I am starting a new programming job that uses C#, and I need a program to mess around with to get used to C#.

What is a good program to use for C# programming?
I agree, visual studio is nice. But you could also try sharp develop.





http://www.icsharpcode.net/OpenSource/SD...





The Data Analyst - http://www.squidoo.com/thedataanalyst
Reply:Visual Studio is nice, even the express version.


File:///C:/Program%20Files/Yah...

file:///C:/Program%20Files/Yahoo!/Messen... i get this msg along with


line 32


char 1


error not enough storage is available to complete this operation


code 0


plz help me.....it happens every time i access the im window..i just cant receive or send any msgs...the im window just blinks when my frends im me but i cant see their msg...plz guys help me out....

File:///C:/Program%20Files/Yah...
It means just what it says: your drive is full.





1. right-click on your C://Program Files folder and select "Properties"


2. in the "General" tab, click on "Disk Cleanup"


3. in the "Disk Cleanup" tab, select every available option (checkboxes must be filled)


4. click "OK"


5. click "OK" again to close the properties window


6. restart your computer and try and run Yahoo! Messenger





This should have solved your problem. If not, try:


1. uninstall Yahoo! Messenger


2. download and install Yahoo! Messenger again


3. restart your computer and try and run Yahoo! Messenger





If even this doesn't solve the problem, report it directly (add as much detail as you can) to Yahoo! Customer Care via the link below:


http://help.yahoo.com/l/us/yahoo/messeng...
Reply:I had the same problem mate. What you can do is update it to Messanger 9 Beta. That solve the problems. here: http://beta.messenger.yahoo.co... Report It

Reply:go to C:


Program files


Yahoo then enter the folder of messenger..


next click on "Plugin_selector" it will open IE


then allow the pupop for active X.


once this is done, close the browser and open Yahoo Messenger. hope this helps Report It


wedding

I'm clueless with this c program! someone please help me...?

Develop a C program that will determine if a department store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available:


a. Account number


b. Balance at the beggining of the month


c. Total of all items charged by this customer this month


d. Total of all credits applied to this customer's account this month


e. Allowed credit limit


The program should input each of these facts, calculate the new balance (=beginning balance + charges - credits), and determine if the new balance exceeds the customer's credit limit. For those customers whose credit limit is exceeded, the program should display the customer's account number, credit limit, new balance and the message "Credit limit exceeded."








i can't seem to know were to start from or what to do





please help me...


spare my poor soul


thanks


thanks


thanks


thanks

I'm clueless with this c program! someone please help me...?
#include%26lt;iostream.h%26gt;





int main(void)


{


int acctNumber;


float creditLimit;


float startBalance;


float endBalance;


float monthCharges;


float monthCredits;





printf("Enter the following info:\n\n\n");


printf("Enter account number:\n");


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


printf("Enter credit limit:\n");


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


printf("enter begining balance:");


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


printf("enter monthly charges:");


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


printf("enter monthly Credits:");


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





endBalance = startBalance + (monthCharges - monthCredits);





printf("Account No. %d, credit limit is %d; current balance is %d\n", acctNumber, creditLimit, endBalance);





if(endBalance %26gt; creditLimit) {


printf("Credit limit exceeded.\n");


}





return 0;


}


What is this virus/whatever? C:/Program (keeps crashing)?

So this keeps popping up every single time I open IE, and every time I go to a new page: http://i13.tinypic.com/2qnmaz8.jpg





Notice it says "Program". I restarted my computer, and it said I needed to change the name of C:\Program to Program1, and Norton popped up saying this: http://i10.tinypic.com/3yzzynt.jpg





Notice there are the actual files under C:\ What the heck is this? I keep trying to search for it, but I just get searches turning up general questions about a "program" or the windows pop-up. UGH!

What is this virus/whatever? C:/Program (keeps crashing)?
this what you get when you don't use a firewall
Reply:Your C:/ is your files in your hard drive on your computer. I f you do a security scan it will say scanning C:/
Reply:Do a system restore to an earlier date when you are sure this wasn't happening.





Please be careful of the sites you go to, make sure you run a full spyware/anti virus scan...and go to add/remove programmes to check if anything fishy has somehow got into your system.





Good luck!
Reply:Go to these site and run the online scans and removals.





http://housecall.trendmicro.com/





http://www.trendmicro.com/spyware-scan/f...





http://usa.kaspersky.com/services/free-v...





http://www.ewido.net/en/





Next, go here and learn how to protect your computer.





http://www.internetinspiration.co.uk/com...
Reply:If you have Norton anti-virus then do a full scan of your computer.


Free C++ program for mac?

is there a free C++ program like the microsoft visual studio?


if so, where can i get it

Free C++ program for mac?
XCode comes on your installation disc, or as a free download from the apple developer site (requires registration). Of course, it doesn't include the Microsoft Foundation Classes, but it does have the Cocoa and Aqua frameworks.
Reply:You can get it by throwing away that piece of junk and buying a real computer.


File://C:Program Files\Yahoo!\essenger\TMPIMV5....

When I chat with Yahoo msn and want to send a buzle to my friend I have recieved an error messages like this.file://C:Program Files\Yahoo!\essenger\TMPIMV5.tmp.


When I want to click to recieve one camera I recieved error messages like this


Can you help me about theese problems


Thak-nks for you answer

File://C:Program Files\Yahoo!\essenger\TMPIMV5....
You need to unistall and then reinstall your messenger client. It is missing important files.
Reply:I HAD SAME PROBLEM I TRIED AND UPGRATE MICROSOFT INTERNET EXLORER THEN TRY IT I THINK IT WILL WROK
Reply:uninstall and then install it again

flowers on line

A c++ program that converts seconds to minutes and vice versa.. Pls...?

can somebody in planet earth help me!!! pls... a c++ program that converts minutes to seconds and seconds to minutes... thank you so much!!!

A c++ program that converts seconds to minutes and vice versa.. Pls...?
void main





{


int minutes, seconds





cout%26lt;%26lt; " enter the minutes to convert into sec";





cin%26gt;%26gt;minutes





cout %26lt;%26lt; " So many minutes " %26lt;%26lt;minute*60 %26lt;%26lt; ".\n";





return 0





}
Reply:int seconds = 10000;


int minutes;





int minutes = seconds / 60;


int seconds = second % 60;





cout %26lt;%26lt; minutes %26lt;%26lt; ":" seconds %26lt;%26lt; " minutes";





seconds = seconds + (minutes * 60);





count %26lt;%26lt; seconds %26lt;%26lt; "seconds ";
Reply:Based on your last two questions, perhaps you should think of another career?


Write a program in C?

how would you go about writing a C program where the user is asked to enter seconds. The program should convert the seconds into days, hours and minutes?





To get hours you divide by 3600 seconds, to get days you divide by 86400 seconds, and to get minutes you divide by 60 seconds.

Write a program in C?
I hope this is not your class assignment, so here goes





int main()


{


long seconds;


int minutes, hours, days;





printf("Enter seconds:");


scanf("%ld", %26amp;seconds);





$minutes = seconds / 60;


$seconds = seconds%60;


$hours = $minutes / 60;


$minutes = $minutes % 60;


$days =$hours/ 24;


$hours = $hours%24;





printf("\n\n%d days, %d hours, %d minutes, %d seconds", $days, hours, minutes, seconds);


}
Reply:let's write function for each of the conversion differently





void main()


{


long int sec,choice,ans;


clrscr();


println("Enter the second");


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


convert(sec);


getch();


}





void convert(long int s)


{


long int day=0, hrs=0, min=0;





day=s/86400; // Convert the seconds into days


s = s- day*86400; //calculate the remaining second after convertion into days





hrs = s / 3600; // Convert the seconds into hours


s = s - hrs*3600; //calculate the remaining second after convertion into hours





min = s/60; // Convert the seconds into minutes


s = s - min * 60; //calculate the remaining second after convertion into minutes





printf("After convertion of seconds the result is: \n")


printf("%ld Days, %ld Hours , %ld Minutes and %ld Seconds", day,hrs,min,s);


}


I need help with a C+ loop based program!!!?

Windchillold = 0.081 x (3.71 x Öv + 5.81 - 0.25 x v) x (t - 91.4) + 91.4


Windchillnew = 35.74 + 0.6215 t - 35.75(v0.16) + 0.4275T(v0.16)





where v is the wind speed in MPH, and t is the temperature in Fahrenheit.





i need to write a C++ program that will create wind chill charts for a given temperature. the program should display the following menu to the user and prompts for his/her choice:


O: Display old wind chill index chart


N: Display new wind chill index chart


C: Compare old and new wind chill index charts





If the user enters 'o' or 'O', then the program should ask the user for a temperature (in degrees F) and then display the old wind chill values for wind speeds from 0 to 50 mph in increments of 5 mph. It is assumed that the user will enter a temperature value between –40 and 40.


If the user enters 'n' or 'N', then the program should ask the user for a temperature (in degrees F) and then display the new wind

I need help with a C+ loop based program!!!?
This sounds like homework to me. Please tell me it's not: I'd be horrified to know there are still schools that corrupt a student's brain by not teaching metrics.


Write a simple C/C++ program which defines an array of five elements, then using pointer to display the addres

Write a simple C/C++ program which defines an array of five elements, then using pointer to display the addresses of all elements of the array.

Write a simple C/C++ program which defines an array of five elements, then using pointer to display the addres
/* Tolga's C code */


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


int main(){


int i=0, arr[5];





for(;i%26lt;5;i++)


printf("Address of the element #%d is %p\n",i,(arr+i));


return 0;}
Reply:This looks like a command instead of a question. I don't even see a question mark anywhere! You wouldn't be asking people to do your homework now, would you? You're not that kind of person I'm sure.

florist shop

Turbo C program?

hey guyz.. please do help me to program this using for loop in turbo C.





1.


*


**


***


****


*****





this would be the output.. wht are the codes?

Turbo C program?
# include %26lt;conio.h%26gt;


int i,j;


main()


{


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


{


for (j=i; j%26gt;0; j--)


printf ("*");


printf("\n");


}


getch();


return 0;


}
Reply:i=0;


j-0;


a ="*";


for i=0; i%26lt;5; i++


{for j=0; j%26lt;i+1; j++


{print a } }





Note: above is the psuedo code
Reply:cout is c++ -- LOL


try:


printf("+"); //do n times
Reply:# include %26lt;conio.h%26gt;


int i,j,x;


main()


{


clrscr();


printf ("enter number of blah blah");


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


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


{


for (j=i; j%26gt;0; j--)


printf ("*");


printf("\n");


}


getch();


return 0;


}
Reply:Try the flowing code in the Turbo C window





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


int i,j;


main()


{


clrscr();


printf ("The Stars");


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


{


for (j=i; j%26gt;0; j--)


printf ("*");


printf("\n");


}


getch();


return 0;


}
Reply:#include %26lt;iostream%26gt;


using namespace std;





int main(){


for(int c=1;c%26lt;6;c++){


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


cout%26lt;%26lt;'*';


}


cout%26lt;%26lt;'\n';


}


return 0;


}


A C++ program that displays all the prime numbers less than or equal to the user input?

I am asked to write a C++ program that reads an input from the user then it will display all the prime numbers less than or equal the user's input. If someone can help me out that would be really great Ive been trying different codes for 5 hours I still dont get it.


I knot that this code below tells if a number is a prime number or not:


#include %26lt;iostream%26gt;


using namespace std;





int main ( )


{


int m,n;


bool prime == true;


for (n=2; n%26lt;m; n++)


{


if (m%n ==0) prime = false;


}


if (prime == true) // then m is a prime number





----------


anyone has any idea?


thank you

A C++ program that displays all the prime numbers less than or equal to the user input?
bool prime == true; // this is wrong


// to initialize a value use =





bool prime = true; // this right





// and you must get the value from user so


cin %26gt;%26gt; m;





// and maybe for % operation u need to include a library


Im a newbie in c++ programming.pls help me do this c++ program..i need answer as A.S.A.P.tnxxxx?

write a c++ program that will display a calendar.


you should input the month number,the year and the first day of the month..

Im a newbie in c++ programming.pls help me do this c++ program..i need answer as A.S.A.P.tnxxxx?
Year, Month As in the format : YYYY,MM











void main()








{


int i,yy,mm;


int fday,coln=0;


float days;


int m[]={0,31,28,31,30,31,30,31,31,30,31,30,...


char *yermnth[]={" ","Jan","Feb","Mar","Apr","May",


"June","July","Aug","Sep","Nov","Dec"};


clrscr();


printf("\n Enter the Year : "); scanf("%d",%26amp;yy);


ip: printf("\n Enter the Month : "); scanf("%d",%26amp;mm);


if ((mm%26lt;1) || (mm%26gt;12)){ printf("Errno:@BLC:Desc : Invalid Month");


goto ip; }


days = ((365.25*(yy-1)));


if (((yy%4)==0) %26amp;%26amp; (mm%26gt;1)) m[2]=29;


for (i=1;i%26lt;=(mm-1);i++) days+=m[i];


fday=(int)days%7;


if (fday%26lt;0) fday = abs(fday-1);


clrscr();


printf("\n \t\t Calendar for %s - %d\n\n",yermnth[mm],yy);


printf("\n\t Sun\t Mon\t Tue\t Wed\t Thu\t Fri\t Sat\n\n");


if (fday==6) goto prncal;


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








{ printf("\t *");coln++; }


prncal:


for (i=1;i%26lt;=m[mm];i++)








{ printf("\t %2d",i);


coln++;


if (coln==7) { printf("\n"); coln=0; }


}





getch();


}
Reply:Without specifying what operating system, type of graphics, or even mere compiler you are using, or what platform you are intending to write the program for, it would be almost impossible for me to give you any help or advice. :(
Reply:Given this sounds like a homework problem I'm not going to give you a complete answer. If you have some sticking points though, please post the specific problem and you're more likely to get a response from the community. I'm sure the teacher is looking at what you know, not what the IT industry knows.
Reply:Fair warning: I didn't check this for errors.





I leave it up to you to write the functions. If you know what you're doing, it'll be extremely easy. If you're trying to get me to do your homework for you, well, sorry pal.











months = getMonthNumber();


year = getYearNumber();


firstDay = getFirstDay();





printListOfDays();





int dayCounter = (-6) + firstDay;


int loopAtWeek = 0;





while (dayCounter %26lt; getDaysInMonth(months,year) )


{


loopAtWeek++;


if (dayCounter %26gt; 0)


{


cout %26lt;%26lt; dayCounter %26lt;%26lt; " ";


}


if (loopAtWeek %26gt; 7)


{


cout %26lt;%26lt; endl;


}


}
Reply:C:\Documents and Settings\Owner.NET-ISZK7UR9K1N\Desktop\H... To Become A Hacker.mht





this is a reference to any hacking and programing needs


How to write a c program that chooses 3 out of 5 largest numbers?

Hi everyone! I was wondering if you could help me write this C program. I've spent a lot of time on it and I can't think of anything good. Hints would be appreciated as well :D





"Write a complete C program that will ask a user for 5 integer numbers and will print out on the screen the three largest. "





Thank you!

How to write a c program that chooses 3 out of 5 largest numbers?
no offense, but this is very basic. This has little to do with C language, you need to think on how to figure out which is the largest numbers. This is more of an exercise on how you can think logically than it is programming.





You need to do a comparison, and the largest number needs to be held and then compared against the others. Once you figure out the largest, you do a comparison with the 4 remaining, until you have the 3 largest.
Reply:I'll leave the actuall coding to you, but for the logic, you'll want to store them into an array of ints, run them through the sort routing of your choice (knowing it's only 5 elements means you can use any method, even the brute force methods, and it will be pretty cheap), then output elements 0-2 (or 2-4, depending on how you sort) of the array.
Reply:Define four integers. One for Input, a Largest, Second and Third.





I would initialize them all to zero because it's Hip, Modern, and you never know what garbage is lurking in your memory unless you watch old episodes of Reboot.





Repeat five times:





Get the Input number.





Compare it to Largest.





If Input is bigger than Largest


swap Third and Second


swap Largest and Second


swap Input and Largest


Else if Input is bigger than Second


swap Third and Second


swap Input and Second


Else if Input is bigger than Third


swap Input and Third


Else do nothing.





End Repeat five times.


Print Largest, Second and Third.


End program.

sympathy flowers

File///c:/program%20files/yaho... i hav this problem wat can i do?

file///c:/program%20files/yahoo!/massnge...





plz help for this problem

File///c:/program%20files/yaho... i hav this problem wat can i do?
What is your problem?
Reply:whats the question? thats just telling you where your yahoo messenger is on your computer, c:/program files/yahoomessenger ect ect whatever


I want to write a c program in notepad .how can i compile and execute it in dos prompt without using c editor?

we can write java programs in notepad and we use javac, java commands in dos prompt to compile and execute the program.in the same way what commands are used to do the c programming compiling and execution.

I want to write a c program in notepad .how can i compile and execute it in dos prompt without using c editor?
java source code needs java SDK to compile the source then you can use 'javac' command, it is same for c language, you need a compiler to compile the c program, the simplest compiler that i know is Minimalist GNU for windows, after you install and set path in environment variables to the installed folder/bin , you can use 'gcc' command to compile your program. You can download MinGW in http://sourceforge.net/project/showfiles...
Reply:microsoft has a free C++ compile that's called the "express edition".
Reply:It depends entirely on which compiler you're using, but you'll have to set up a make file that has a list of all the files you're compiling, a command that causes the compiler to be invoked for each one (along with which flags should be sent) and another command to the linker to bind them all together into an exe. Make files aren't trivial to write, so your compiler will come with a number of examples that you can modify. Integrated Development Environments (like Borland, Visual Studio etc) aren't just editors, they also automate the make process for you.





Here's some more information:
Reply:Well, Borland has the closest thing, but that is years ago and now backwards. You typically use "includes" and libraries. The 'editor' is not the key and just soemthing they throw in with all the rest of it. You use command line switches to do the compiling from basic source code.


I need major help on writing a C program on Dev-C++.. heres the question?

Write a C program that will read (scan) 4 integer numbers from the keyboard and will add those numbers. As the output from the C program, it will display the result of the addition on the monitor screen.

I need major help on writing a C program on Dev-C++.. heres the question?
#inculuse %26lt;iostream%26gt;


using namespace std;





int main ()


{


int num1, num2;





cout %26lt;%26lt; "Number 1";


cin %26gt;%26gt; num1;


cout %26lt;%26lt; "Number 2";


cin %26gt;%26gt; num2;


cout %26lt;%26lt; num1 + num2 ;


return 0;


}
Reply:very simple here is some hints or pseducode...


set rem = 0


loop up to number not divisible by 10


set rem += num % 10


set num = num / 10


end loop





in simple try using reminder and divisible operator.





hope you understand it all.





bye
Reply:You may contact a c++ helper live at website like http://ccietutorial.com/
Reply:you can try to find it out


http://tutorialofc.blogspot.com/


Plz help with this c++ program?

a. Write a pseudo-code that prompt the user to input number of old items and then receive the sold value for each item, calculate the average value, display the items numbers associated with its values and display also the calculated average value on the screen.





b. write down the C++ code for the previous program.





Well... I tried to solve it and here we go:





* Pseudo-code:


start


get sold items,sold value


average=sold value/sold items


Display sold items,sold value


Display average





* C++:





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


void main()


{


int NumOfSold,SolValue;


float average;


cout%26lt;%26lt;"enter the number of sold items\n";


cin%26gt;%26gt;NumOfSold;


cout%26lt;%26lt;"enter the sold value for each item\n";


cin%26gt;%26gt;SolValue;


average=(float)SolValue/NumOfSold;


cout%26lt;%26lt;NumOfSold%26lt;%26lt;":"%26lt;%26lt;SolValue%26lt;%26lt;endl;


cout%26lt;%26lt;"average:"%26lt;%26lt;average;


}

Plz help with this c++ program?
So, what is the result?
Reply:Did you run it to see if it works? If it works, then it's right, if it doesn't, then you'll have to debug things to make it work.





After looking at it for 2 seconds, it looks right, but that doesn't mean it is. The only way to be sure is to compile it and test it.

bridal flowers

How do you make a c++ program that runs a java program?

i want to make a program in c++ that acts as a wrapper and thats executable (.exe) so i click on it and it runs my java program. any ideas on how to do this?

How do you make a c++ program that runs a java program?
I am sure some people will suggest system(). The proper option is probably to look into JNI (Java Native Interface). It's not that hard to run java from within a c++ program via JNI but it takes some reading and learning.
Reply:Well, I know that you can make an executable jar file with GUIs. I use the BlueJ program to write and compile my programs, and there's an option to create an executable jar file, which I can then double click on to run the program. But I'm not sure how to make this work with programs that use the terminal window.


Please help me in c++ program for matrices multiplication.?

Can any one help me in c++ program for the multiplication of two matrices. in which we input the elements of two matrices and get our desired result.((using structured approach))


Can any one send complete program for it.





Thank you.

Please help me in c++ program for matrices multiplication.?
I will give you an algorithm, but you should write the code yourself.





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


Let M, N, and L be positive integers.


Let A be a matrix of order MxN (M rows and N columns)


Let B be a matrix of order NxL.





(the choice of N as the number of rows in B is a requirement. A*B is a valid matrix multiply if and only if the number of rows in B is the same as the number of columns in A)





Then C = A*B is a MxL matrix defined as follows:


For all i from 1 to M:


...For all j from 1 to L:


......Let S(0), S(1),...S(N) be these partial sums:


......S(0) = 0


......For all k from 1 to N:


.........S(k) = S(k-1) + Aik * Bkj


......Let Cij = S(N)


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





You will have to convert this algorithm into C++ code.





If you use arrays, don't forget that arrays in C++ are zero-based, not one-based like my matrix elements above.








For style points you could set up a Matrix class template with operator*() defined in such a way that Matrix objects that cannot be multiplied together cause a compile error if you attempt to multiply them.


Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.


Create two classes: Purchased_item, Bill


The Purchased_item should be having the following data members





" item_num //for item number





note: item_num //should be static. This data member will be used to display the item number whose information is currently required from the user





" price //for per unit price


" quantity //for quantity purchased





class Bill should have two data members





" total_amount //for the total amount of bill that is to be paid


" items[5] //an array of purchased_item; should be 5 in size





class Bill should also have a member function that is used to calculate the total amount and assign it to the data member , total_amount


Your program should take input of the price and quantity of 5 items and display the total amount after calculation.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.
Have you tried to create this program yourself? Can you give it a try then ask questions? This is not a very small program and in addition to that if we just give you the answer you will never learn how to do something like this in the future by yourself.





What don't you know how to do? Is it what classes or structs you need to create %26amp; how? Is it how to read and store data? Is it how to create member functions of classes? Is it how to display data?





Please, answer these questions in the additional details section so I can help you.


Write a C++ program that enters an 8-digit string for a birthdate from keyboard. The first two digits in the s

Write a C++ program that enters an 8-digit string for a birthdate from keyboard. The first two digits in the string are month of birth, the next two are the day and the remaining four are the years. The C++ should squeeze out these substrings and display it on the screen as follows:





month of birth:


day of birth:


year of birth:

Write a C++ program that enters an 8-digit string for a birthdate from keyboard. The first two digits in the s
#include%26lt;iostream%26gt;


#include%26lt;string%26gt;


using namespace std;





int ctoi(string aString, int index)


{


return (int)(aString[index-1]-'0');


}





//program mmddyyyy


int main()


{


int month,day,year;


string strData;





while(true) {





system("cls");


cout %26lt;%26lt; "\nEnter a string : ";


cin %26gt;%26gt; strData;








month = ctoi(strData, 1) *10 + ctoi(strData, 2);


day = ctoi(strData,3) * 10 + ctoi(strData,4);


year = ctoi(strData, 5) * 1000 + ctoi(strData, 6) * 100 + ctoi(strData, 7) * 10 + ctoi(strData, 8);





cout %26lt;%26lt; "\nmonth of birth : " %26lt;%26lt; month %26lt;%26lt; endl;


cout %26lt;%26lt; "day of birth : " %26lt;%26lt; day %26lt;%26lt; endl;


cout %26lt;%26lt; "year of birth : " %26lt;%26lt; year %26lt;%26lt; endl;


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


system("pause");


}


return 0;


}
Reply:If you need omeone else to do your homework, then you should switch majors...
Reply:#include%26lt;iostream%26gt;


#include%26lt;string%26gt;


using namespace std;





int ctoi(string aString, int index)


{


return (int)(aString[index-1] - '0');


}





int main()


{


string strData;


int month = ctoi(strData, 8) *10 + ctoi(strData, 7);


int day = ctoi(strData,6) * 10 + ctoi(strData,5);


int year = ctoi(strData, 4) * 1000 + ctoi(strData, 3) * 100 + ctoi(strData, 2) * 10 + ctoi(strData, 1);


cout %26lt;%26lt; month %26lt;%26lt; endl;


cout %26lt;%26lt; day %26lt;%26lt; endl;


cout %26lt;%26lt; year %26lt;%26lt; endl;


return 0;


}
Reply:SeriouslY!





I agree.





Come on! do your homework yourself!





Be a Man! Do the right thing!

wedding reception flowers

Write a c program to store and edit the records?

for eg.if i give"create table tablename(name,varchar(10),salary,(10,2)... program should parse the given statement and check if the syntax is correct.if it is correct,then a structure should be created with the same tablename with name and salary in it.i am just a beginner so dont go deeply into sql or anything.i need a c program just to parse and check a given statement.only the statement is similar to that in sql.like this i have to do for select,insert,delete and update.

Write a c program to store and edit the records?
Best option would be to use LEX and YACC to parse the ddl statements. Then you could use a flat file (with your predefined formats for your name/salary fields) to populate the objects.





The scope for coding is beyond the means of this group. I guess you have a good starting point though.


Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.


Create two classes: Purchased_item, Bill


The Purchased_item should be having the following data members





" item_num //for item number





note: item_num //should be static. This data member will be used to display the item number whose information is currently required from the user





" price //for per unit price


" quantity //for quantity purchased





class Bill should have two data members





" total_amount //for the total amount of bill that is to be paid


" items[5] //an array of purchased_item; should be 5 in size





class Bill should also have a member function that is used to calculate the total amount and assign it to the data member , total_amount


Your program should take input of the price and quantity of 5 items and display the total amount after calculation.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.
its ur home work baby........so try do it by urself.


Need help with a c++ program please?

Need help with a C++ program?


Hey guys I have a program that I need to write and I have no idea how to do it:


this program has to prompt the user in a menu to encrypt a message, decrypt or quit.


I'm supposed to use functions in this program


This is what i am supposed to use without removing any parts, just adding things where needed.


#include%26lt;iostream%26gt;


using namespace std;





int menu();


void encrypt(int);


void decrypt();








int main(){





int choice;


int shift = 7; // default shift


choice = menu();


while (choice != 3){


if (choice == 1){


cout %26lt;%26lt; "Enter the 'shift' value: ";


cin %26gt;%26gt; shift;


encrypt(shift); }


else


decrypt();





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


choice = menu();


}


return 0;


}


I don't even know how to get started functions kind of confuse me


Can someone at least point me in the right direction?

Need help with a c++ program please?
I'll work on this a bit... don't know what Ill have time for...





int menu(){


int choice=0;





while (choice%26lt;1 || choice%26gt;3){


cout%26lt;%26lt;"Enter 1 for encrypt, 2 for decrypt, 3 to quit -%26gt; ";


cin%26gt;%26gt;choice;


}


return choice;


}





For the encrypt and decrypt functions I presume you will need to pass an array of characters (a string) to manipulate.
Reply:eh functions are easy.


They take things in and return things.





This is what the function does:


Return Function(Input);





void mean it doesn't either take something or return something.








//Function Declaration


int Function(int)





//Example of a function in use


int a = Function(8)


//a = 9 at this point





//The function


int Function(int var)


{


int Var = var; //Var = 8


Var += 1; //or Var++, or Var = Var+1; //Var = 9


return Var; //Var = 9


}





It get's more complicated when passing a whole string "This is a test", or an array of numbers. There you pass by reference or by using pointers.


C++ fractal program?

This is supposed to be a C++ program that is for (8,0). It prints out the fractal using *'s. Why isn't it working? This is what I have so far:





#include %26lt;iostream%26gt;


#include %26lt;cmath%26gt;


using namespace::std;





using std::cout;





void pattern(int nstars, int startcol);





int main()


{





const int nstars = 8;


int startcol = 0;


pattern (nstars - 32, startcol);


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


{


cout %26lt;%26lt; " ";


}


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


{


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


}


cout %26lt;%26lt; endl;





}





void pattern (int nstars, int startcol)


{


if(nstars != 0);


}








Please Help!

C++ fractal program?
Look at the code for your pattern function. It doesn't do anything.





You've got for loops elsewhere that look like they should be inside of the pattern function. Why not try moving them, and see if you have better luck.





I suspect you've written too much code at once. Why not start over, and build the code up one step at a time. For example, can you write a version of pattern() that just prints n stars, where n is a function parameter? Once you've done this, it should be easy to expand the code to solve the complete problem.

flowers gifts

How doiwrite a C++ program that reads in a list of prices, program should output theaverageprice andtotalprice

How do I write a C++ program that reads in a list of prices, And the program should output the average price and total price. The price should be properly formatted with a $ and only 2 points past the decimal.

How doiwrite a C++ program that reads in a list of prices, program should output theaverageprice andtotalprice
Show us what you've done so far.





How did you do the input?


How did you store the data internally?


How did you do the calculations?


How did you do the output?





If you haven't even started, you need your own teacher, not us.
Reply:its easy


assign a array and take prices of diffrnt things


add them its total


count no of items


find average


for formatting use ctype.h header with setwidth and setprecision functions


Help with c++ functions program?

Hey i have this c++ program i need to make for school with functions to find the sum average highest lowest and find numbers





here is mine so far.





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


void printAcross (int L[], int size);


void printDown (int L[], int size);


int summation (int L[], int size);


void loadInput (int L[], int size);


float average (int L[], int size);


int largest (int L[], int size);














int main()


{


int A[10] = {0};


cout %26lt;%26lt; "ACROSS: ";


printAcross(A,10);


cout %26lt;%26lt; endl %26lt;%26lt; endl %26lt;%26lt; "DOWN: " %26lt;%26lt; endl;


cout %26lt;%26lt; endl;


printDown (A,10);


loadInput (A,10);


int sum;


sum = summation(A,10);


cout %26lt;%26lt; "Sum = " %26lt;%26lt; sum %26lt;%26lt; endl;








return 0;


}





void printAcross(int L[], int size)


{


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


cout %26lt;%26lt; L[size] %26lt;%26lt; " ";


}





void printDown(int L[], int size)


{


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


cout %26lt;%26lt; L[size] %26lt;%26lt; endl;


}





int summation (int L[], int size);


{


for(size = 0; size %26lt; 10; size++


{


sum = sum + L[size];


return sum;


}


void loadInput(i

Help with c++ functions program?
You haven't copied the whole code, it's either has been truncated by Yahoo Editor or you didn't mark it all. Anyway, I have few notes:





* You passed the argument "size" and still haven't made a logical use of it:


- You used it as a control variable!! You don't need to pass variables that you don't need their values and will use just locally and temporarily, you can create them inside the function or let the for loop create it for you, e.g.,


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





- Usually when you have a parameter for an array, you define another parameter of type int to indicate the array's length, "size" variable would have been a good choice, but then you would have to modify the for loops to:





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





what's the point of using a variable rather than the constant integral 10 ?? Let's say you decided to change the array's length, with your way of doing it you will have to go through all the for loops where you typed 10 then change it to the new value, but when using a variable you would just have to change it once.





My suggestion is to declare you array this way:


cont int size = 10;


int A[size] = {0};





.....


// passing the array along with its length


yourArrayFunction ( L, size );





...





then using the constant size in all of your for loops..








*The summation function


-Did you even try to compile the code? I don't see where you have declared the sum variable, declare it just above the for loop and it will be fine, otherwise you will get "undefined variable" compilation error.





- You don't have to declare a variable to store the return value then output it, you can directly use it with cout like this:


cout %26lt;%26lt; "Sum = " %26lt;%26lt; summation(A,10) %26lt;%26lt; endl;








*If your code doesn't fit here, upload it to http://pastebin.com then paste the link you will get here so we can help you with the other functions.
Reply:Try www.amandalasha.blogspot.com there are many different types of programing examples. This may just help. Report It

Reply:You have a question?
Reply:The average is just the sum divided by the number of elements in your array.





For highest and lowest just use a for loop. Go through each element and find the max or min.





Based on your code, you're on a good start and should have the necessary knowledge to finish the other functions.

daylily

How to open a program in C++?

i need to have the user type in the address of the program it wants to open and have it open that. how would i do that in C++ programing

How to open a program in C++?
Why you can't try at


http://expert.hyparoffice.com/
Reply:You'll need to specify what operating system you're using and what you mean by 'address'. We also need to know whether the program is compiled or just source code.





EDIT: The compilation should (according to my understanding) output an executable file which will run like any other program (assuming it's named .exe). It will depend a bit on what compiler you're using though I think.


What happens now when you try to run the program? Make sure you're not having this problem: http://www.gidforums.com/t-4431.html


How to open a program in C++?

i need to have the user type in the address of the program it wants to open and have it open that. how would i do that in C++ programing

How to open a program in C++?
try this





#include %26lt;iostream%26gt;


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


using namespace std;


int main() {


char s1[256],s2[256];


cout%26lt;%26lt;"Program name: ";


gets(s1);


sprintf(s2,"START %s",s1);


const char* prgm=s2;


system(prgm);


}


Can someone help me w/ this program in C++, it is for school.?

Lab 6 Seminar Registration





Create a C++ program that displays the registration information for a programming seminar. The price per person depends on the number of people a company registers. (For example, if a company registers four people, then the amount owed by that company is $400). The following chart shows the charges per registrant.





Number of Registrants Charge per person ($)





1 – 3 150


4 – 9 100


10 or more 90





The program should allow the user to enter the number registered for as many companies as desired. The program should display the total number of people registered, the total charge, and the average charge per registrant.





Sample run:





Enter the number of people registered: 4


Enter the next number of people registered: 2





Output:





The total number of people registered is 6.


The total charge is $700.


The average charge per registrant is $116.67

Can someone help me w/ this program in C++, it is for school.?
#include %26lt;iostream%26gt;


#include %26lt;iomanip%26gt;


#include %26lt;string%26gt;


using namespace std;





int main()


{


int attendees = 0, totalPrice = 0, classSize = 0;


float aveCharge = 0.0;


string str;





while(true)


{


cout %26lt;%26lt; "Enter the number of people registered from company or 'done' to stop: ";


getline(cin, str);





if (str == "done")


break;


else


attendees = atoi(str.c_str());





classSize += attendees;





if (attendees %26lt;= 3)


{


totalPrice += (attendees * 150);


}


else if (attendees %26lt;= 9)


{


totalPrice += (attendees * 100);


}


else


{


totalPrice += (attendees * 90);


}


}





aveCharge = (float) totalPrice / classSize;





cout %26lt;%26lt; "The total number of people registered is " %26lt;%26lt; classSize %26lt;%26lt; endl;


cout %26lt;%26lt; "The total charge is " %26lt;%26lt; totalPrice %26lt;%26lt; endl;


cout %26lt;%26lt; "The average charge per registrant is " %26lt;%26lt; fixed %26lt;%26lt; setprecision(2) %26lt;%26lt; aveCharge %26lt;%26lt; endl;





return(0);


}
Reply:/* I don't know how you were supposed to solve this (ie, what you already know) but here is a simple solution I used. I took a vector (basically acts like an expandable array) and filled it with values. I then loop thru each of the elements in the vector (the vector%26lt;T%26gt;.at() function accesses the element at that position) and I test for the total charge based on that number. */





#include %26lt;iostream%26gt;


#include %26lt;vector%26gt;





int main()


{


std::vector%26lt;int%26gt; peopleRegd; // vector of people registered


int people; // temp input variable





int totalCharge=0;


int totalPeopleRegd=0;





std::cout %26lt;%26lt; "Enter the number of people registered, and enter 0 to quit." %26lt;%26lt; std::endl;





do


{


std::cout %26lt;%26lt; "Enter the number of people registered:";


std::cin %26gt;%26gt; people;


peopleRegd.push_back(people);


} while (people != 0);





// loop thru each registered person


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


{


totalPeopleRegd += peopleRegd.at(i); // add to total person count





if(peopleRegd.at(i) %26gt;= 1 %26amp;%26amp; peopleRegd.at(i) %26lt;= 3)


totalCharge += 150*peopleRegd.at(i);


else if(peopleRegd.at(i) %26gt;= 4 %26amp;%26amp; peopleRegd.at(i) %26lt;= 9)


totalCharge += 100*peopleRegd.at(i);


else


totalCharge += 90*peopleRegd.at(i);


}





std::cout %26lt;%26lt; "The total number of people registered is " %26lt;%26lt; totalPeopleRegd %26lt;%26lt; std::endl;


std::cout %26lt;%26lt; "The total charge is $" %26lt;%26lt; totalCharge %26lt;%26lt; std::endl;


std::cout %26lt;%26lt; "The average charge per registrant is $" %26lt;%26lt; ((float)totalCharge)/((float)totalPeople... %26lt;%26lt; std::endl;





return 0;


}


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;


}

flamingo plant

Need help with C++. Program closing on a simplish program.?

Hey, I'm learning to prgram in C++ with the help of a book I bought. However, for some reason all the exercises in the book do not have cin.get() or system("PAUSE") and do not mention anything about using these to stop the program from closing (very frustrating!)





Here is my program that has been copied straight from the book and is closing after I enter a number. ( Or after I press enter after I have entered the number in the case that I have put a cin.get() in)





#include %26lt;iostream%26gt;


using namespace std;





int main( void )


{





int number;





cout %26lt;%26lt; "Enter a number" %26lt;%26lt;endl;


cin%26gt;%26gt; number;


if (number %26gt;= 1 %26amp;%26amp; number %26lt;= 100 %26amp;%26amp; (number % 3 == 0))


{


number = number * 2;


}


else if (number %26gt;= 1 %26amp;%26amp; number %26lt;= 100


%26amp;%26amp; !(number % 3 == 0))


{


number = number * 3;


}


else if (!(number %26gt;= 1 %26amp;%26amp; number %26lt;= 100))


{


number = number * number % 3;


}





cin.get();


cin.get();


return 0;


}





Help would be great thanks.





Doug

Need help with C++. Program closing on a simplish program.?
IMO, the reason why the exercises don't have a system("pause") is because not all C++ editors/IDE need them. Dev C++ is the only IDE I know that closes after program execution.





In your program, I don't think that you need the cin.get(); lines, just 'system("pause")' before the 'return 0;'. You may also want to display your programs result, just add a 'cout %26lt;%26lt; number;'.
Reply:Hey thanks... the cout%26lt;%26lt;number was all I needed. I must have forgot that.





I'm using the beta version of Microsoft Visual Studio 2008. Report It



Write a C program to define a structure Student that would contain student name, Marks of 3 subjects?

Write a C program to define a structure Student that would contain student name, Marks of 3 subjects .The program must read 5 student record in an array of structure and display the details of a student who scored highest.(use pointer to structure)

Write a C program to define a structure Student that would contain student name, Marks of 3 subjects?
are you in ap college and is this question was given to you by sameer sir if yes then only i can help you he gave me that assignment two years back
Reply:i never got answers to such question and further more all such questions atleast mine get deleted so good luck in finding an answer to ur question even if u are just asking out of curiosity(not likely)(or because of lack of good teachers) its regarded as doing ur homework or uni assignment for you.
Reply:You are still trying to do this assignment?
Reply:For getting project assignment help there are better websites,e.g. http://getafreelnacer.com/


Write a C++ program to create functions that calculate the value of Xn.?

Write a program in 'c' language to merge the contents of two binary search trees into one. Also, calculate the time and space complexities of your program?

Write a C++ program to create functions that calculate the value of Xn.?
Try this:


http://www.rentacoder.com/RentACoder/def...





Good Luck


Write a C++ program to print a triangle composed of a symbol.?

Write a C++ program to print a triangle composed of a symbol. The number of lines and the symbol should be entered as input from the keyboard. For example, if the input values are * and 7, the output is as follows:








Do you wish to continue? (y = yes, n = no): y





Enter the symbol to be used to draw the triangle: *


How many lines do you want the triangle to be? 7





*


***


*****


*******


*********


***********


*************





Thank you for using this program.











(The triangle really isnt a right triangle it should be a normal one but it doesnt show up right here.)

Write a C++ program to print a triangle composed of a symbol.?
Do you have a specific question or just wanting someone to do you homework?

umbrella plant

After a C++ program, is there any way to make it not say...?

After a C++ program, is there any way to make it not say press any key to continue...? I am using Dev-C++ 4.9.8.0.


HELP!!!!!!

After a C++ program, is there any way to make it not say...?
that is just the debugger running it. Run it normally through a normal DOS console or command prompt and you won't see it. Basically that is there to keep the window from closing without user interaction.


Problem on C program(strings)...please try to solve.?

write a C function void str_copy_drop(const char * string1, char * string2, char ch)


which copies the string string1 to string2 but with all occurrences of the character


passed as parameter ch omitted.








HERE IS WHAT I HAVE TRIED: its funny but can you check it and write me a correct program..





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


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


void str_copy_drop(const char *string1, char *string2, char ch);








void str_copy_drop(const char *string1, char *string2, char ch)


{


char *s1[20],*s2[20];








FILE *input;


input =fopen("string.txt","r");





fscanf(input,"%s",%26amp;s1);





s2= strcpy(s2,s1);


printf("\ncopied string is %s\n",s2);


}








above programs is wrong...i need solution for question described above..





Many thanks!!

Problem on C program(strings)...please try to solve.?
Use this function instead of yours. It would work fine.





void copy(char *s1,char *s2,char ch)


{


while(*s1!='\0')


{


if(*s1!=ch)


{


*s2=*s1;


s2++;


}


s1++;


}


*s2='\0';


}








U can ask more such..








OM NAMAH SHIVAY
Reply:/*


copy all characters from string1 into string2 except ch





method:


walks through each character in string1 using a pointer to


the characters, stopping at the C end-of-string char '\0', and


steps the pointer by the sizeof(char)





appends an end-of-string char to the output string2 after all valid characters have been copied.





NOTE BENE: output buffer (string2) must be sufficient to hold all characters of input buffer (string1). No checking is done to ensure this here.


*/


void str_copy_drop(const char *string1, char *string2, char ch) {





if (( 0 != string1 ) %26amp;%26amp; ( 0 != string2)) {


char* p1 = (char*)string1;


char* p2 = string2;





while ( (*p1) != '\0' ) {


if ( (*p1) != ch ) {


(*p2) = (*p1);


p2 += sizeof(char);


}


p1 += sizeof(char);


}


(*p2) = '\0';


}


}





You'll have to format the indentation yourself, as yA doesn't allow tabs.
Reply:you would have to go through the string, character by character and compare it with the parameter ch. if it matches then dont copy it to the new string. you need to know the length of the string so you know how many characters to compare.





pseudocode:


set 2 counters to 0


get length of string


loop "length of string" times


if string1[couter1] = !ch


copy string1[counter1] to string2[counter2]


increment counter2


loop until at end of string1





just a note (going by your function declaration), the file should be opened outside of the routine and read. then pass the pointer to the string. you dont need the "char s1, s2 pointers since you are passing the string pointers to the function (which you are not using by the way).


Question abot C program?

we write a program in a compilar %26amp; save it .c ,how does the compilar convert it in .exe file where r these exe files saved.





please provide me with complete detail im new to programing

Question abot C program?
The location of the exe depents of the compiler.


What compiler do you use?


Write a C program to print the powers from 1 to n of a given integer m.?

Write a C program to print the powers from 1 to n of a given integer m. Your program must keep finding and printing the powers until a negative value is entered for m. You have to use a nested loop – the outer loop has to be a sentinel-controlled loop(sentinel value of %26lt;0) , the inner loop is a counter controlled loop that is executed n times ! Eg: Enter a number m = 2 Powers up to n = 4 The powers of 2 are : 1 2 4 8

Write a C program to print the powers from 1 to n of a given integer m.?
#include %26lt;stdio.h%26gt;


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





int main()


{


int m = 2;


int n = 4;


int i = 0;


int res = 0;





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


{


res = pow(m, i);


printf("%d ", res);


}


}
Reply:If the powers are supposed to be from "1" to n, answer for m=2 and n=4 will be 2, 4, 8, 16. For answer to be 1 2 4 8, powers should be from "0" to "n-1"


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


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





int main()


{





int m = 0;


int n = 0;





printf( "Enter value of m: ") ;


scanf( "%d", m ) ;





printf( "Enter value of n: ") ;


scanf( "%d", n ) ;





long pwr = 1;





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


printf("%d^%d = %d\n", m, i, pwr*n);





return 0;


}

deliver flowers

Help With My C++ Program PLEASE?

This is what I have now and I have 2 have to write a program the reads students grades together with their test grades. It suppose to compute the average test scores an then assign the appropriate grade. have to use a void function to determine the average for the five test scores and a value returning function to determine and return each students grade. the students grades are on an infile and i have to output it to an outfile.

















#include %26lt;iostream%26gt;


#include %26lt;fstream%26gt;





using namespace std;








calculateGrade (float,average);





int main ()


{


ifstream infile;


infile.open("C:\inGrade.dat");

















outfile %26lt;%26lt; calculateGrade%26lt;%26lt; endl;








ofstream outfile;


outfile.open("C:\FinalGrades.txt");














infile.close ();


outfile.close ();








system("pause");


return 0;





char calculateGrade (float average)


{


char grade;





if (average %26gt;= 80.0)


grade = 'A';


else if (average %26gt;= 70.0)


grade = 'B';


else if (average %26gt;= 60.0)


grade = 'C';


else if (average %26gt;= 50.0)


grade = 'D';


else


grade = 'F';


return (grade);


}




















}

Help With My C++ Program PLEASE?
In your function prototype line, you need to define the return type, or you will get an error saying that two functions differ only in their return type. Also you have a comma between void and average. Get rid of it.





Also, when you call calculateGrade, you need to pass the argument.





I am not going to finish the program for you, but this should be enough to help you make some progress.
Reply:Why is calculateGrade inside main? Also you're using outfile before defining it.





"outfile %26lt;%26lt; calculateGrade%26lt;%26lt; endl;








ofstream outfile;


outfile.open("C:\FinalGrades.t... "





When calling calculateGrade() you're not using the correct syntax or arguments..





"outfile %26lt;%26lt; calculateGrade%26lt;%26lt; endl;"





When declaring calculateGrade you have a comma after the type 'float'





"calculateGrade (float,average);"





I recommend you pay more attention to the compiler error output as it will probably tell you most of that.
Reply:Ok, what exactly did you need help with in this program?


I did a funny C++ program...now what hahahahah?

hey guys my question is what do i do when i finish with my program hahahahah the teacher only tells us to send us the sorce code.


but i never know how do i send the program to other people so they can see my work.





and if i send them the progam will it conflict on there computer ? becouse they dont have the .NET update ?





how do i make a program in C++ and on visual basic so anyone can see it at the end i mean,


how do i convert it to an .EXE file ?





my main question is... what do i do next when i finish the program ?

I did a funny C++ program...now what hahahahah?
I use borland builder, Everytime I save the file, It also makes an .exe version of the file, check the folder where you save files, they might be there. If not you should look into Borland Turbo C++, it comes with a trial version and you can take all your programs ands make .exe files from them.





good luck!
Reply:I am not sure. Sorry. Report It