how to "Bold search result in C++"
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: how to "Bold search result in C++"

  1. #1
    Join Date
    May 2013
    Posts
    2

    how to "Bold search result in C++"

    hi,

    i need to know, that how i can get search result in bold format(using sequential search technique) from an array, in C++ graphic mode ???

    e.g.

    here is an array : 2 4 5 34 0 -45

    and search key == 34

    when it found 34 in array, '34' should bold to be prominent.

    regards.

    pls reply soon.

    thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,315

    Re: how to "Bold search result in C++"

    There is no such thing as "C++ graphic mode". However, there are ways to get text to be bold in a C++ program, but that depends on what exactly you have in mind (a console based program? A GUI?) and what library you're using.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  3. #3
    Join Date
    May 2013
    Posts
    2

    Re: how to "Bold search result in C++"

    thanks for the response.

    i am using windows 7 64bit, and Turbo c compiler.

    i have created a simple program in c++ graphic mode using library graphics.h, my program focused features are :

    1) user will give values those will be store as an array, and when search button clicked on, a key will be ask to search and as search result i have showed the position(index) and count of the key value, but, 1 thing more to show is the part of my assignment that this key value should be appear in 'bold' format, if it exists in list/array.

    2) i tried settextstyle() function for this purpose, but, it is not helpful. or may be i'm not using this function in proper way.

    3) here given below is my code to perform search function, if you kindly guide me where and how i have to stick this function in this code;

    cout<<"Enter a value to search : ";
    gets(ch);
    gotoxy(8,8);
    cout<<" ";
    gotoxy(5,9);

    cn=valid(atoi(ch)); // check
    if(cn==0)
    {
    gotoxy(8,8);
    cout<<" ";
    gotoxy(8,8);
    cout<<"INVALID DATA......";
    delay(700);
    gotoxy(8,8);
    cout<<" ";
    gotoxy(8,8);
    cout<<" ";
    }
    else
    {
    gotoxy(8,8);
    cout<<" ";
    gotoxy(8,8);

    int number=atoi(ch);
    searchno(number);
    }

    void searchno(int number)
    {
    int found=0, counter=0;
    for(int i=0;i<posx;i++)
    {
    if(array[i]==number)

    {
    found=1; //indicator to check if found.

    counter++;
    //Bold(char text[i], int row, int col);
    settextstyle(10,0,1);

    cout<<number <<" found at Position ["<<i+1 <<"]" <<" and Total count of " <<number <<" is [" <<counter <<"] ";

    }
    }


    if(found==0)
    {
    //gotoxy(30,3);
    cout<<number <<" not found in the list.";
    }
    }


    please guide me how to use this function or any solution else.

  4. #4
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,556

    Re: how to "Bold search result in C++"

    When posting code, please format with indents properly and use code tags (Go Advanced, select code, click '#').

    If you can't do 'bold' format, why not just change background/foreground colour to 'highlight' the answer?

    You might also want to look at

    http://www.cprogrammingexpert.com/C/.../graphics.aspx

    which has some examples of using graphics.h package.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center