Alittle help for a beginner please...

This is a discussion on Alittle help for a beginner please... within the C++ Programming forums, part of the General Programming Boards category; no the do while is correct you dont need to ask the first time through the loop. i would still ...

  1. #16
    Registered User ~Kyo~'s Avatar
    Join Date
    Jun 2004
    Posts
    319
    no the do while is correct you dont need to ask the first time through the loop.
    i would still say just make some char and at the end do a
    char = getch();
    and for a condition just make sure it doesnt == n or N

  2. #17
    Registered User
    Join Date
    Sep 2004
    Posts
    38
    well at any rate, I'm going to take the info you guys have given me and see if I can't make a go of it. If it still doesn't work, guess I'm come ask for somemore help. Thanks again.

  3. #18
    Registered User ~Kyo~'s Avatar
    Join Date
    Jun 2004
    Posts
    319
    Code:
    #using <mscorlib.dll>
    #include <stdlib.h>
    #include <iostream>
    #inlcude <conio>
    using namespace std;
    using namespace System;
    
    int main()
    
    {
    double a = 0;
    double b = 0;
    double c = 0;
    double d = 0;
    double Average = 0.0;
    String *anotherAverage = "";
    Boolean Y = 1;
    Boolean N = 0;
    char temp;
    do
    
    {system("CLS");
    
    Console::Write("Enter first number: ");
    	a = Convert:: ToDouble(Console::ReadLine());
    
    Console::Write("Enter second number: ");
    	b = Convert::ToDouble(Console::ReadLine());
    
    Console::Write("Enter third number: ");
    	c = Convert:: ToDouble(Console::ReadLine());
    
    Console::Write("Enter fourth number: ");
    	d = Convert:: ToDouble(Console::ReadLine());
    
    Average = a + b + c + d /4;
    
    Console::WriteLine("Average: {0}",
    Average.ToString("N2"));
    
    Console::Write("Do you want to get another average? (Y/N)");
    temp = getch();
    }
    while (temp != 'n' && temp != 'N');
    cin.get();    //used for wait?
    
    
    
    
    return 0;
    }
    
    //end of main function

  4. #19
    Registered User
    Join Date
    Sep 2004
    Posts
    38
    [QUOTE=~Kyo~][code]
    #using <mscorlib.dll>
    #include <stdlib.h>
    #include <iostream>
    #inlcude <conio> //I get a invalid preprocessor command on running it



    lol, nevermind got it going. But still something fishing goin on, now nothing displays at all on screen. Well, guess I'll mess a bit before I go to bed. Thanks.
    Last edited by Xeavor; 09-23-2004 at 11:27 PM.

  5. #20
    Banned
    Join Date
    Aug 2004
    Posts
    128
    <conio.h>

  6. #21
    Registered User ~Kyo~'s Avatar
    Join Date
    Jun 2004
    Posts
    319
    I have enough strange libs loaded into my msvc++ as long as I know the name it works =) conio or conio.h both seem to work for me but i got allegro and some other stuff in here too.

  7. #22
    Registered User
    Join Date
    Sep 2004
    Posts
    38
    Got it to load up now...just trying to figure out why nothing displays but black screen now.

  8. #23
    Registered User
    Join Date
    Sep 2004
    Posts
    38
    ok got it working, seems I had alot of uneeded stuff in there huh lol. Well anyways, thanks guys. Lots of help, guess I have lots and lots of more studying ahead of me huh? later.

  9. #24
    Registered User
    Join Date
    Sep 2004
    Posts
    40
    this isn't complex code. you need to create a function. ill work one out in about 2 mins so ill post code when im done. you don't need the complex code you posted. i know you've fixed it but i feel like this

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 11:48 AM
  2. What are some good beginner programs I shouold make?
    By oobootsy1 in forum C# Programming
    Replies: 6
    Last Post: 08-09-2005, 02:02 PM
  3. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 10:21 AM
  4. Resource ICONs
    By gbaker in forum Windows Programming
    Replies: 4
    Last Post: 12-15-2003, 06:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21