User Profile
Collapse
-
Thank you sir. I should be able to get it working now -
Weird Errors
Hi, I'm using visual studio 2008 and normally when I get an error it shows what line it is on and which file etc. The error I'm getting I don't know how to solve or even what the problem is. This is the whole output when I try to run the program.
"1>------ Build started: Project: corysid, Configuration: Debug Win32 ------
1>Compiling...
1>implementatio n.cpp
1>Linking...
1>actualmain.ob j : error... -
Thank you guys, you did a good job explaining how I cannot get a decimal value from dividing 7/2but can with 7.0/2.0. I'm not sure how I can change an integer value to a double or float though. Here's a snippet of my code (the part that applies to my question)
Code:if ((length+1)%2 ==0) { median= ((value[length/2]+value[length/2+1])/2); }
Leave a comment:
-
Simple Float Question
I made this code as an example of my question. The actual program I will be making is bigger but I made this just to test, and be able to show what I'm asking.
Code:#include <iostream> using namespace std; int main() { float average; float average2; average=3.5; average2=(7/2); cout << average << endl; cout << average2 <<
-
I know that the array has multiple strings, not character type. I need to know how to give the first character in each string to the variable firstChar so that it is a character so I can compare it to '/' and ' '. Which I don't know how to do.
From what you said above, "codeArray[arrayNumber][0]" will give me the first character?
Thanks for replying
EDIT: ok cool, that is working it counted 48 comments...Leave a comment:
-
I've figured out some of my problems but have run into more on the way, the new question can be found here http://bytes.com/answers/c/857099-ha...ng#post3438862
thanksLeave a comment:
-
Having char variable access parts of a string
I have an array of string values, and I need to access each character of the string individually. For instance I want my char variable to equal the first character in the string, and then compare it to character values using if statements. Later in the program I will need to not only access the first character but all of them individually in each string. How can I set that up?
Here is my code for trying to have the charcter variable... -
Comparing Array values
I have to write a program that takes the lines of code from a .cpp as a string into an array. Then I need to compute the ratio of total lines of code to the number of comment lines, and ratio of total number of non comment and non blank lines to the total number of code.
This is the void function that I am using to get these ratio's.
Code:void CommentEvaluation(/* in */ string codeArray[], int size, ofstream& dataOut)
-
Sorry you were correct the error I get was an initializing error and not a declaration error.
I set it now to:
int POINT = 0;
And I had the other 2 reversed like you said. Now POINT = myRoll
I no longer get the error but I've run into trouble with the nested If statement within the while statement. Here are the changes I made (I only made changes to the playLineFunctio n)
Code:void playLineFunction(int
Leave a comment:
-
Using functions or modules help
I have to write a program that lets the user play the game of Craps. As of right now it is incomplete and I have run into some errors. It's my first time using functions instead of the program all being in the int main().
I am using visual studio on windows XP.
In my code I've defined a local variable in a function but when I run the program and it gets to that function it says I have an undeclared variable.
... -
Thank you. It was overloading the pow() function. It is now working correctly. So when using a variable as the exponent or power you should define it as a double?
FIRST is defined as a float at the beginning of the code.Leave a comment:
-
Using a variable as a power
How can I use a variable as a power in C++
for example an equation n^n
should pow(n ,n) work?
I have a program for a class where a variable FIRST is the first number inputted from a file. I need to then work out the factorial using the equation
n! = e^(-n)*(n^n)*sqrt(2 *pi*n)
Using FIRST as my variable instead of N I came up with the following equation:
FACTORIAL = (((pow(2.718281 83,...
No activity results to display
Show More
Leave a comment: