I'll edit this when I've finished reading it but for starters, why is there text in Swedish? What's in the cout doesn't matter, but for variables, it'd help others with appropriate English names.
Oh, and wrap your source code in tags: [ code ] source code here... [ /code ] without space between brackets.
As for the Swedish part, it's just for future reference. I like to think of it as common courtesy to make it easier for those who take their time to help you =)
I'll try to learn to wrap my code right, hope I did it right now. And like Browni say I thought that this is so simple code that I didn't need to translate but I'll give it a try now.
OUTPUT:
Type an integer:32 //This line works as I want to, when I hit enter it prints out the OUTPUT part after this line.
Type a string with two or moore words: Type a double: The Integer is: 32
The string is:
The Doble is: 6.95322e-310
What to try again press 1, else press 0:
Thank you!!
I'm 44 years old so I study most for fun, but it is a real education i'm doing on distance. I have a full time work in a softwarecompany as a salesman and projectleader.
So I though it would be nice if I get some understanding about what my programmers do. My goal is to try some Objective-C on the Mac in the future.
About my code, I have changed place on
1 2
cin.get(aChar, 30);
cin.ignore (30, '\n');
to
1 2
cin.ignore (30, '\n');
cin.get(aChar, 30);
Then it works but I'll be very glad if someone will explain why for me.
Ah, I see. Is that a high school-level course, or is it a university/college course? Or is it provided through another company (educational or otherwise)? While mostly interesting in computer game development, I would like to try my hands on Objective-C in the future as well as AppleScript. I own both a MacBook and an iPhone, might as well take advantage of that and the programming...
Anyway, about your querie: When you first input data through cin >> and press the return key, you leave behind a '\n' character. You'll want to use cin.ignore() to tell the program to ignore that character. You might also want to ask yourself why you want to put 30, '\n' or both inside the parentheses of cin.ignore().
I know my answer is incomplete. Hope this helps for now, though.
Yes, that's my plan if I work this first course out. I study in 25% speed so my weekends are all about reading and coding. I use Apples Xcode to do my coding, works fine for me and is good for the future as my plan is continue with Objective-C.
I'm using Xcode as well. I like it a lot, find it much easier to use than Eclipse or NetBeans, for instance.
So we're both doing the same thing then. =) Well, best of luck to you! I'm doing the C-course full-time right now, and it's a huge step-up from the B-course. The magnitude of the C-course is almost ridiculous.