User Profile

Collapse

Profile Sidebar

Collapse
millman
millman
Last Activity: Nov 10 '11, 05:21 PM
Joined: Oct 21 '11
Location: United Kingdom
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • millman
    started a topic A binary search with even amount of numbers

    A binary search with even amount of numbers

    In a binary search, with an even amount of numbers, will the algorithm choose the higher or lower middle number?

    So if the array is:

    15 18 18 21 26 31 36 38

    Then will it start by looking at 21 or 26?
    See more | Go to post

  • millman
    replied to Loop back to the start of a program?
    in C
    no problem thanks anyway alexis
    And to solve the problem that when you enter an odd number into the running program it won't show the next ten alternate numbers. But i still need a code to loop back to the start. Anyway, this is the corrected program.
    Code:
    #include <StdAfx.h>
    #pragma hdrstop
    #include <conio.h>
    #include <ctype.h>
    #include <iostream>
    
    //----------------------------------------------------------------------
    ...
    See more | Go to post

    Leave a comment:


  • millman
    started a topic Loop back to the start of a program?
    in C

    Loop back to the start of a program?

    Code:
    #include <StdAfx.h>
    #pragma hdrstop
    #include <conio.h>
    #include <ctype.h>
    #include <iostream>
    
    //----------------------------------------------------------------------
    
    using namespace std;
    using std::cout;
    using std::endl;
    using std::cin;
    
    int main ( ) { 
    int i;
    int x;
    
    std::cout << "\n
    ...
    See more | Go to post

  • Don't worry, i worked it out myself but just incase anyone else has a similar problem you need two equals signs like this == in the if statement. Also if you use windows visual c++ you need this header file. #include <StdAfx.h>
    See more | Go to post

    Leave a comment:


  • Error message 'non-lvalue in assignment', any suggestions?

    Code:
    #pragma hdrstop
    #include <conio.h>
    #include <ctype.h>
    #include <iostream>
    
    #pragma argsused
    
    //-------------------------------------------------------
    
    using namespace std;
    int main ( ) { 
    int i;
    int x;
    std::cout << "\nPlease enter an even number:";
    cin >> x;
    if(x%2=1)
             std::cout <<
    ...
    See more | Go to post
No activity results to display
Show More
Working...