I have compiled the code again, and it does give me the output above!
So did I and I got
C:\>x
Enter two numbers:
10 20
You entered: 10 and 20!
10
C:\>
Try looking at the code you're compiling and compare it to the posted code.
I have compiled the code again, and it does give me the output above!
So did I and I got
C:\>x
Enter two numbers:
10 20
You entered: 10 and 20!
10
C:\>
Try looking at the code you're compiling and compare it to the posted code.
Bingo...
Welcome.
Where did you learn that if(menuinput == (l || L))
is a valid IF statement? You need to look up how a compound statement is written.
And what's the purpose of assigning l = 'l';
and L = 'L';
just to use variables in the IF statement? Use the characters themselves.
Change your browser's font to one that uses different characters for the letters.
You really want us to look through 650 lines of code to
1) find you compare function?
2) figure out what's wrong?
Sorry, nope. Pinpoint the problem areas and we can see what we can find.
The code you posted cannot display the output posted.
The simple solution is use a FOR loop.
Very simple. Why don't you try something and if it doesn't work, post it.
Back to probability. You need to use srand()
and rand()
to get your probability. Get a random number between 0 and 99. If the number is 30 or more the record is OK. If < 30, reject it.
Now I also like to put the include files in there while i'm at it. some have suggested that is bad practice, but they have not sufficiently explained why.
I guess that would depend on what they are for and of putting them in a subdirectory would make the process cleaner. Personal preference IMO.
Read the entire line.
Check the characters looking for a letter. That's the beginning of the name and the end of the account number.
Next check looking for a digit. That's the beginning of the address and the end of the name.
Etc...
Write calMonth()
"source2.c" will have its own corresponding "source2.h". "whatever.c" will have its own corresponding "whatever.h". and these individual header files will have only those #includes, #defines, etc. that their corresponding source files require.
In my opinion, if nothing in the header is used elsewhere, the header is unnecessary. All can be defined in the C source.
That doesn't mean you can't create one for the purpose of uncluttering the source. But in general, if it's not used in another module, a header would just be another file requiring and complicating maintenance.
Follow your post as if it were a map of your program. You've got it all there and in an order you can use.
If source2.c doesn't need anything in library1.h, library2.h, another.h, etc.h, why include them? As L7Sqr said, it's just noise. The compiler is doing work for no gain.
Will fix the double-clicking of forum folders. Not sure why those don't work. Anything else broken?
Yep. Now when I click on "Mark this Forum Read" it simply refreshes the forum without marking anything, leaving me in the forum rather than the forum index.
Would you mind explaining how you 'save' numbers? It's so much faster than trying to understand 452 lines of code.
You should have a warning about removeLast()
. Did you see it? If so, did you ignore it?
What's all that at the end of your post?
Also, visiting threads does not set the icons to READ.
Now clicking on the thread icons no longer goes to the unread posts. Even after ^R.
Probably. GOOGLE finds a lot of stuff for me.
because function is not being called...
Prove it. Add printf()
statements to prove it's not being called.
No error message, just crashes? Nothing to give you an indication why? That's really strange. Try to pinpoint what statement causes the problem.
Or if stringstream is too advanced, atoi(argv[i])
will also suffice.
i will be an index into the argv array.
First thing you need to do is understand both languages well and understand the grammatical rules for each language then be able to tell what translates to what from what I see in your post you do not understand english well enough to tackle a program like this you need to understand the concept of sentences and punctuation
hey I am new in C++ and I have finished my code but my Prof. asked me to write pseudocode and I have no idea what that is and I dont know how to write it.
Well, in my opinion, you should have ask him this when he told you to do it.
But, in lieu of that, pseudo code is describing what the program does in a (Pick Your Native Language)-like manner.
Thing like:
1) Input the values for height and width.
2) Calculate the area with (height * width) / 2
3) Display the result
Just thought of something. If you don't know anything about it and your Prof never taught you, how did you know is was spelled pseudocode? :icon_wink:
Let's start with these two functions first:
• int lastDig(int num);
This function returns the last digit of num.
If you pass in the value 100101101 this function will return 1. You can do this using the modulus (%) operator.
• int removeLast(int num);
This function returns a number without the last digit. For example, removeLast(123) would return 12. The body of this function can be accomplished with one line.
Divide.
Remember, you have a binary representation in integer form. It's still an integer, in base 10, not base 2.
Put the srand()
functionn call back in main()
.
And where's the header that define the random functions?
A couple things on your statement
while(fscanf(in,"%s %s %s\n,",&day,&mon,&year)>0)
1) you don't need the &. Each variable is already a pointer since they are arrays.
2) >0 is OK if only one of the values is needed. Use =3 if you want all values to be correctly entered.
Depending on your O/S, look up the system's Execute functions. There should be one that allows you to execute Program 1 and wait until it exits.
Other option is to run Program 1 and just before it exits, start program 2 with system()
What are the values of wordStart, wordEnd and command[wordEnd] during the loop? cout
is your best debugging tool.
So post what you have now.
First, please format your code properly so we can follow it. All loops and ifs need to be indented:
Dim q, e, g As Integer
'parr(mini) = maxi
If mini <> maxi Then
If nop > 0 Then
For e = 0 To maxi + 1
'On Error GoTo hell
parri(e) = 0
'hell:
Next e
End If
If non > 0 Then
For g = 0 To Abs(mini) + 1
narr(g) = 0
Next g
End If
Next, assuming parri is defined to have maxi elements, your first loop goes beyond the limits:
For e = 0 To maxi + 1
parri(e) = 0
Next e
Yes, easiest is to open the file for read and check for an error.
And how do you plan on taking the cubic root? Did you look up what pow()
does?
And....?
Explanations help.
What's the equation for a geometric mean?
I meant:
while (in_stream.good() && in_stream.get(A) != ' ')
not the other way around. This is why I never got good grades in school :)
Well, since we frown upon giving solutions to people, maybe you should refrain from posting code anyway. After all you don't get the grades. They do...
Hi
When you ask for a person to write what code he/she has written and then ask questions based on his/her code other people can simply copy and paste his code.
That is true...
That is called COPYRIGHT.
No, that is not copyright. Copyright is a legal status of intellectual material. If you read the Acceptable Use Policy below you will see under Posting that "Posts contributed to the community immediately become the property of DaniWeb upon submission." Therefore the post is DaniWeb's, not yours. If you post copyrighted material on DaniWeb, you do so at your own risk. Read the rest of the Posting section mentioned.
so you should person to delete his/her code
So how does someone person? How does the verb person relate to delete? Sounds illegal.
In Explorer:
Right click on the file containing the code
Choose DELETE.
1) Please format your code so we can read it properly.
2) Do not use gets()
, here's why.
3) main()
is not a void function. See this.
4) To get help, you need to show an attempt. There is no attempt in this code for 4 & 5.
Use peek to see what's ahead one character. This is probably the easiest way, but maybe not the most efficient.
Yes, inefficient, and bad. You have to read the next character anyway, so why peek, then read?
Look at line 27. Is that an assignment?
Yes. strstr()
in string.h
the line
free y
cause problems.
After 30+ posts you should know better by now.
Ground it for a month with no TV.
should i use it after
return y
If you use it after return y
will it be executed? What does return y
do?
[EDIT]
I see this question has already been answered here. You didn't believe him?
[/EDIT]
Then I suppose the expression should be
co-1 >=0 && grid[ro][co-1] == '.'
so that am assured that the points being tested are within the array. Is that not so?
Please turn your brain on and read and think about what I said:
If you have
A && B
,
1) how can you guarantee A is not evaluated because B is FALSE?
2) how do you know A isn't evaluated first?
3) how do you know they both aren't evaluated, then the && is performed at the end?
And to corollary of #2
2') how do you know B isn't evaluated first?
How does the && prevent it?
If you have A && B
,
1) how can you guarantee A is not evaluated because B is FALSE?
2) how do you know A isn't evaluated first?
3) how do you know they both aren't evaluated, then the && is performed at the end?
Last time. What is the value of grid[-1][0]
? You are checking that location. Same with grid[0][-1]
I did some COBOL in the 80's and 90's under DOS/VSE, MVS and VSE/ESA. Also, some MicroFocus Cobol under PC-DOS back in the day. What is your question?
I'm sure after 4 months he's was just waiting for someone to ask him to post his question :icon_rolleyes: