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.
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.
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.
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.