Look into saving and loading to and from a file too. it might be useful.
Look into saving and loading to and from a file too. it might be useful.
Sorry. My bad. Student names is a std::string array, right? Do the test on the specific element you're talking about? So:
if (studentNames[i] == "stop" )
{
break;
}
In that case.
>> studentNames = "stop"
studentNames=="stop"
Use code tags! [code] PUT YOUR CODE BETWEEN THESE [/code]
So the problem is in sorting the arrays? Look into this - http://www.cplusplus.com/reference/algorithm/sort.html It's the standard sorting method. The example there is numerical but I'm certain it does alphabetical data too.
>> if there are less then 20 clients being entered i would like to be able to stop the loop when the user enters a certain key term such as "stop"
>> If name = 'stop'
It depends on the type of name. If it's std::string then you can indeed do the above (but with " rather than '). But if it's a c-style string you're going to have to use strcmp(). Look them both up in the aforementioned site.
You have you array, right. So what you could do is loop for an undefined number of times and read in a value into a secondary variable. Test this variable agains break values. If it is one (eg if it's "stop", as above), break from the loop. You should look into dynamic array allocation and after that vectors or maybe (linked) list or something.
How are we meant to defend ourselves for the impending alien attacks if we don't enhance ourselves? Thankfully colonies from the future have send back in time 'videos' and 'movies' to train us in such matters.
>> Nobody can have a house like that. Government won't allow it.
Why not?
Calvin: Dad, how do cash machines work?
Calvin's Dad: There's a small man behind the machine and when you say how much you want he posts it out the hole.
Calvin: Oh! Just like the man who opens the garage door?
Calvin's Dad: Exactly
It's like that for most automatic things, Lard. Don't even ask me how transistors work. It's a whole community of small people.
Tea. http://allaboutirish.com/library/foodbev/affairtea.shtm They say the Irish drink about 7kg of tea per person per year... I'm on about my 20th already I reckon.
Oh the memories!
I can't understand it.
I voted yes, but not recently!
The last time I remember doing it was when I was 13. I was in a French grammer test and I hated French. I learnt those LORT/Hobbit runes for it especially and wrote the French-equivalent on my school bag! It was premeditated cheating which makes it all the more bad, eh? Cheating-one straight off!! 25-life. The person next to me was caught cheating at the same exam (he was not as subtle as I), so the teacher brought him outside and asked him why he was cheating. He said that he did it because I was cheating so she brought me outside and asked me if I was cheating. I looked her square in the eyes and said 'no' (I'm a good liar apparently). She asked why the other guy said I was and a shrug of the shoulders satisfied her.
The time before that was also in a language test but when I was in primary school, I was ... 10ish. I went to an all-Irish speaking primary school but was no good at writing it (slight dyslexia I imagine. My English spelling is rotten), so my spelling tests were always abysmal. I could speak it fine though. My teacher was bored out of her mind giving us a spelling test and wasn't paying attention to the class so grasped the opportunity (I can still remember my heart beating!) - I took my book out and opened it at the appropriate …
Your girlfriend's parents? Cool.
Also, 4 of your posts in the front page of the lounge have 'awesome', or 'amazing', in them :) That is pretty odd though.
Put (int*) before the error area.
Or look up some C++ casts.
Thanks for the explanation, Ptolemy. I hadn't heard of them before. Sounds like fun to implement. I can only assume that one uses the 'boundrary conditions' (ie start and end nodes where previous and next respectively will be NULL), to extract the next and previous addresses of all the other elements. Would be a bit more painful if it was a completely cyclic list though.
I glossed over your explanation, sorry. I assumed you were explaining XOR to me :) Makes sense.
First things first. Do you know how to write a regular linked list?
Please elaborate. A linked list I can understand. Exclusive or I can understanc. Doing a linked list using XOR ... I'm not certain what you mean.
How do you know it doesn't return anything? All you know (or at least have shown us), are the prototypes. I assume it assigns a value to the int pointer 'kptr' and because its type is an int star assignment from a function must return an int star.
Also, I assume this is an assignment? Hmm. Main returns an integer so 'int main()' with a 'return 0;' at the end of its scope is what you should be having. Was the 'blanked' code given by the teacher...
search google for code::blocks or devc++ ... are microsoft giving one away still?
Well, no. It's not.
Do you understand recursion? It's essentially another method of looping but rather than using while() or for(), for example, a function recursively calls itself:
void count_down( int num ) {
if ( num>=0 ) {
std::cout<< num;
cout_down( num-1 );
// Calls the function again but this time the
// parameter is one less than before. By this
// you can iterate through all the values you
// need to. Use control statements to determine
// how to proceed.
}
}
That's not the most imaginative example of recursion but it should give you an idea.
Also. Using recursion on main() is normally considered not good.
Not only that but for strings you appear to be using ' rather than ". While neither method will work ...
Since you're using C++ you might as well use std::string rather than character arrays. Try an if-else if ladder rather than a switch.
#include <string>
//...
std::string str;
std::cout<< "Enter something: ";
std::getline( std::cin, str );
if ( str == "something" )
std::cout<< "str == something!";
else
std::cout<< "Not anything";
"Never let the truth spoil a good story"
I didn't mean it like that.
I meant in the sense of you maybe getting tempted ...
Tea and more apple cake.
>> How ever did you guess?
I bet it was the sceneary in the background of your avatar.
>> I really don't think that it is up to the US who gets to use Nuclear power and who doesn't.
Didn't it come out recently that the original reason for building Sellafield was for under the cover enrichment? It's something I remember hearing before... Can't remember where though.
I hate the way America's arrogance makes them, from time to time, believe that they have the right to dictate to the world what they can and can't do while they do exactly the opposite - you can't have nuclear enrichment plants (alegedly for power production), but we can. It's like your taller, older and jerk of a brother holding your face in the mud.
Heh. Maybe this thread isn't the best place to be when not eating.
getline( cin, N ); is your function then.
And what's the error? I'm guessing it's in the number of parameters. Pass in the size of the string (?), N too:
cin.getline( N, 12 );
Or whatever size it is.
http://www.cplusplus.com/reference/iostream/istream/getline.html
I like how politically correct your title was!
I recommend celebration! What are you doing here?
Happy birthday, though. Now you have no excuses to not be unsensable. :)
I can just imagine iPods with casette slots in them! Ha!
You ever play Portal? Good game!
No. You can destroy your lungs all you want, Serunson. Just not your liver.
Or mother-daughter. Heh. If I was in that situation (which I won't be, but for the sake of the arguement), I'd call my mum mother-daughter.
There must be a reason ... money, I doubt it. As csgal said - just wait a few years. Maybe a bastardised Oedipus complex? Kill grandfather marry grandmother? Maybe the ultimate rebellion from his parents/her kids (but waaaay too far)? Could it have been unknown?
>> what a cop out. says she who hasn't voted yet :P
Cop out, eh? I voted smart, but why not go for a three-in-one deal while in the market?
I'm going to say someone I enjoy being with who is both smart and hot...
>> you just stop right there. respcet the metal man.
Heh. I respect their talent - clearly they have that in abundance, but in terms of quality ... I'll respect your wishes and 'stop', ok? :)
My apples are nearly running out now. Apple crumble with custard. Mmmmm.
Pff. IMO, dragonforce are senseless fantasy-metal with lots of talent but no soul.
Did you read my post? You could think about tidying it up by checking if it's above
if (PeopleTypes>4 || PeopleTypes<1){...}
What's that say when you replace it?
Well one option would be to create an integer called 'max_value', or something. Set it equal to the first element of the array. Iterate through the entire array and test each element against the max value. If the element it bigger assign, else leave it.
To answer your question: no.
>> PeopleTypes != 1,2,3,4
Do you want it to be or, or and?
OR:
PeopleTypes != 1 || PeopleTypes !=2 || PeopleTypes !=3 || PeopleTypes !=4
AND:
PeopleTypes != 1 && PeopleTypes !=2 && PeopleTypes !=3 && PeopleTypes !=4
Aint pretty but you'll get over it.
Nah. Go more classic - Sonic the Hedgehog!
>> anyone else having problems with JB's DL?
Nope. But oddly FF didn't tell me that it had downloaded when it had.
Bet if you copied it into notepad, pasted it and copied it again it'd fix the colours.
You just start the guitar? The AIM beep made me jump!
Yes. One thing you could do is create a running-sum of numbers and ask the user at the start how many numbers they want to insert, then loop that many times. After it's all looped divide by the number of iterations which were inputted.
Alternatively you could read the numbers in as strings, stringstream to a number (you familiar with stringstreams?), and keep the same running-sum as before and after loopin' divide by the number of iterations.
Or you could read in integers until someone enters an invalid value ... like a character where you require an integer.
>> If I input a letter instead of nummber how can I make it so program says that it is invalid input value or something like that ?
#include <ios>
#include <iostream>
#include <limits>
int main( void ) {
/* ... */
int num;
while ( !(std::cin>>num) ) { // If the inputting failed
std::cout<< "You didn't enter an int!\n";
std::cin.clear(); // Make sure to clear the stream's errors
std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' ); // and remove the offending characters.
}
// num fine here.
return 0;
}
>> decision == "B" || "b"
That isn't what you think... what you want is:
decision == "b" || decision == "B" or you could do some kind of toupper() usage. That applies to all the comparisons too.
>> How about mars
You think the Martians want our waste?
>> Also, fusion reactors, according to what I have read, are not very clean
A hard thing to do is get impartial information which tells you about the pros and cons. What have you read, and where? Fusion reactors are scary things.
>> Building new and improved versions will also create much needed jobs.
As too will nuclear (and any), power generation stations.
>> Oh yeah, what wonderful countries will uranium come from?
http://upload.wikimedia.org/wikipedia/en/8/8d/Uranium_%28mined%292.PNG Lots of places. Australia seems to be quite full of it.
Where do all these lies about TV and the Internet come from?
>> I think that existed in the past but the IRA blew it up
Haha. Correct. i'd forgotten about that. But I should have been more specific - between mainland UK at high voltage DC, not Northern Ireland. They're going to re-make that one since things between the north and republic are better now.