unary ++,and - operators for fraction class
What about them? We're not her to write code for you. We are here to help you when you are stuck writing your program.
unary ++,and - operators for fraction class
What about them? We're not her to write code for you. We are here to help you when you are stuck writing your program.
You cant end a program with an empty for loop. Either fill it with something or get rid of it. The compiler is expecting your for loop to have a body to it but it currently does not.
Anyone know what Algorithm Verification implies?:-/
To make sure the algorithm is a valid solution to your problem. Type code based on your algorithm to see if the algorithm actually works in a real program. If it doesnt work, the algorithm is flawed and must be re-written.
Yes I run Dev c++ on Windows vista and windows xp
I don't think you want to be printing "n" in the last prinf statement.
I think you want to print the number which is just the variable n.
Also please post your code using code tags so smiley faces dont show up in the middle of the code. ;)
EDIT
It also looks like there is somehing wrong with the for loop. Generally a for loop consists of three terms, with the last one being an increment or decrement.
I'm not sure what language your using, but not(soktkund==kundnr) is not the same as not(hittkund).
You are using different variables.
By the way, the if statement on line 11 is missing a ')'
>So I removed (!hittkund) Should I have done that?
Why would you remove this? I thought that was what you were trying to test. If I understand correctly, I think you want to output an error message if the customer number is not in the file. So this if condition would be needed correct?
Ok no problem. Please mark the thread solved if you have no other questions. Thanks.
You should just download a free c++ compiler. I use Dev C++ and I am 100% satisfied with it. With Dev you can type up your program , save it as filename.cpp, press the F9 key to compile and run. It's that simple.
Try putting
using namespace std;
after your include statements.
Also I'd put
return 0;
before your last }
In its current state, you intend the while loop to check if the cutomer number is in the file. So, if the customer number is NOT in the file, the loop wont execute. I think your if statement should come after you close the while loop. Is that clear? Let me reiterate. If the while loop fails, it wont execute the if statement becuase it is contained within the while loop. You want the if statement to execute if the while fails. So this is why I think you should move the if statement out of the while loop. I hope that was clear.
i looked at your message you didn't show me any direction
Thats because you are in the wrong forum. Also I dont think a switch or while loop are effective ways of solving your problem. I'd use arrays and for loops.
You can prompt the user to enter either 1 or 2. Then use while loop to decide what to do with the input.
int choice;
while(choice==1)
{
//enter customer number
}
The while loop will execute until the user enters a number other than 1.
I was also thinking about using an if/else statement.
if(choice==1)
{
//enter customer number
}
else if(choice==2)
{
//return to menu
}
else
{
//print illegal input message
}
no problem, first time on this site. I am new to c++ I am writing a switch and while program to tally up the total grades and find the average can you give me some direction
I know, you already pointed that out in your previous post. Why don't you read my previous post again, and this time concentrate. ;)
no problem, first time on this site. I am new to c++ I am writing a switch and while program to tally up the total grades and find the average can you give me some direction
Like I said you should probably post your question in the c++ forum. Create a new thread and post the code you have already tried. When you post code remember to use code tags. Showing effort is the most important thing when posting on Daniweb. No one will help you if you dont show that you have given considerable time and effort to your problem. Remember, we're not here to do your homework for you. Thanks.
Hi,
I have a question on writing a c++ program can anyone give me a hand?
Don't you think the c++ forum would be a better place for your question?
We will be glad to help you if you show effort and don't expect us to do the whole program for you. By the way, next time you need help writing a program you may want to tell us what the actual problem is.
i dunno how to write the coding o.....i try to find it....i am very poor in programming coding ...
Have you ever programmed in c++ before? You need to declare an array of size 10 and fill it using a for loop. Start trying to code this part, then you can try moving on to sorting.
hiiii i want source code for online banking management system....in php...
And I want a billion dollars. Can't always get what you want.
Moderators may want to think about closing this thread. I don't see it going anywhere helpful albeit comical. ;)
Why don't you try searching the forums? The whole point of keeping the code in previous threads is so people will be able to learn from them in the future. I've seen this question asked many times in the past few weeks. Or you can actually try doing it yourself (that would be the prefered method) ;)
This question seemingly has nothing to do with c++. In the future dont post math related questions in the programming forums.
As for your problem, what does the question ask you to do? Do you have to solve for the variable r?
Im glad we could finally solve the problem. Thanks for your patience. You were an excellent poster and showed great effort. Please mark the thread solved if you have no further questions. Thanks once again.
The problem may be resulting from the fact that there are only 9 planets and the loop is iterating 10 times. That is, the array has 9 elements, but the for loop is counting 10 times. Try changing <=9 to just <9. Let me know howit goes.
Can you please post your code so we can see the problem in context. Thanks.
*Sorry BestJewSinceJC I didnt realize you already asked the same question until after I posted ;) *
Yes sometimes a little focus can go a long way. Please mark the thread solved if you have no further questions. Thanks.
It doesnt appear that you have sum declared anywhere, unless you included it in the part A of the code. Also, you are not telling the program to do anything after the loop takes place. Output the variable sum after the for loop to see if your program actually works. ;)
This forum is for game development. It is meant for people who are facing difficulties while making thier own games. If you are having a problem with your hardware post your question in the appropriate Hardware forum. Thanks.
A while loop would work just find and is easier to understand.
Not sure about easier to understand but yes a while loop can be used to accomplish part one. For loops aren't all that complicated. ;)
<snipped> Yes Mikeyp926 is correct. Sorry for that post.
My bad :) I didn't give him any free code neither did I compile it.
It is ok to make and post corrections to a poster's code. Just let him know what you did and why his original code is wrong. After all that is the point of the software development forums. Don't just throw uncompiled code at the poster. Help him to understand his mistakes.
Can you please tell me what you are trying to accomplish with this program?
If all you are trying to do is print the string then you can use this
#include <iostream>
using namespace std;
#include <iomanip>
#include <String>
int main ()
{
system("cls");
string Object;
cout << "Enter the object you wish to create: ";
cin >> Object;
cout << "Initializing \"" << Object << "\"" << endl;
cout << "Initailization Complete" << endl;
cout << "Compiling \"" << Object << "\"" << endl;
cout << "Compiling Complete" << endl;
cout << "Creating \"" << Object << "\"" << endl;
cout << "FATAL ERROR IN C DRIVE" << endl;
cout << "ABORTING CREATION OF \"" << Object << "\"" << endl;
cout << "Program succesfully aborted" << endl;
cout << "Hard drive wiped to protect computer" << endl;
cout << "Have a nice day." << endl;
char wait;
cin>>wait;
return 0;
}
The last part with cin>>wait stops the screen to let you read the output before the screen closes.
Disregard Phil++'s code. It won't work because he messed up the quotes.
@ Phil++
If your gonna give away free code, the least you could do is make sure it actually works.
This isn't the first time you disobeyed the rules by giving away code.
There are some more problems that I'd like to point out.
If I am understanding the problem correctly you want to test what BillType the user enters. To do this you need to use if else statements.
if(Code_Letter == h)
//do home calculation
else if(Code_Letter == c)
//do commercial calculation
else if(Code_Letter == i)
// do industrial calculation
else
//print error message for invalid input
Also you cant say
c = commercial;
c is a char variable and commercial takes on a float value.
Your else if is a little flawed. Change it to.
if (Code_Home)
{
h = home + home1 * Num_Gallons ;
}
else if (Code_Commercial)
{
c = commercial;
}
else
{
i = ; // not sure what your trying to do here
}
When writing multiple cases, use else if until you reach the final case.
By the way this is just the structure of the else if tree. You need to change some things to the code to get it run properly.
Well thats a step in the right direction. You need to create variabes that correspond to the parameters defined in the method definitions. Then pass those parameters in the method call.
Here is how a method call generally looks
name_of_method(parameters separated by commas);
Not every method needs parameters, but in your case, all of your methods do.
Follow my last post (#8). Here I told you how I would call methods. You must write the name of the method and pass in parameters.
Read this if you get stuck again.
http://java.sun.com/new2java/divelog/part1/page6.jsp
EOF means End of File.
This link will give you some examples of how it is used in C.
http://www.cprogramming.com/faq/cgi-bin/smartfaq.cgi?answer=1048865140&id=1043284351#
Read the first sticky thread in the c++ forum if your looking for some problems of ranging difficulty.
Create variables of appropriate data types and pass them as parameters in the functions. Print the value returned by the function call. I'd do this in the main method.
You may want to change the function from void to char and have it return the char value of the grade. Pass the numeric value of the grade as the parameter. Try that. I'm not positive that it will work but I definitely think its worth a shot. Let me know how it goes.
C:/DOS
C:/DOS/RUN
RUN/DOS/RUN
Funny little joke, I first saw on the tv show "The Simpsons".
The error on line 33 is because you are trying to return a double value in a method thats declared as int.
I'm not a big expert in astronomy, so I can't really help you there, but obviously you will need to put something in the main method. Try calling the functions in the main method to see if they are working correctly.
Pray to Jesus for the knowledge.
It may be only the Hebrew Bible, so Jesus wouldn't apply in that case. At any rate, funny post. LOL
My apologies. It's just anecdote. Like my post states at the top, it's finished code. I just thought that some people would get a kick out of someone wasting so much time on such an obvious mistype. :)
No need to apologize. Many programmers face the same problem you have described in this thread. Its very easy to overlook a key ingredient that is missing from a code. Many times a single character can mean the difference between a successful program and a frustrating message from the compiler. ;)
Why don't take a shot at coding the program and report back with any problems you encounter. Don't just type your homework assignment up and expect someone to do it for you.
yeah your right.
so "processScore" needs to be in main right?
That's where I'd put it.
By adding each element in the array.
This is a pretty simple task.
For part one you need to use a for loop.
For part two use an if statement to see which value is larger.
Do you have a question about this code? Or were you just sharing a personal anecdote? Generally, the software development forums are reserved for people to ask questions to try to fix thier code. But yeah, sometimes the most obvious solution is the correct one. In fact that quote was my signature a little while back ;)
Use a while loop. The stopping condition should be retail value = 3.14
while(retail_value != 3.14)
{
//put your code that executes the program here
}
Now when the user enters 3.14 as the retail value, the loop will stop and output will terminate.
Perhaps I missed something, but I can't find where you are calling the processScore function. And this is where the number grade is converted to a letter grade. Please correct me if I am wrong.