Wondering how or if you can change the font type/size and color in a regular c++ console window. If so please include appropiate header(s). using VC6
EvilSource
Posts
-
Console Font/Color -
get char in console probhow do i get a single ASCII character from the user, useing a console window, without having to use the return key. i want the user to use the arrow keys (and some others) to move pices of info around on the screen. how would i go about doing this and what headers will i need.
-
Template/class link errorbut how do i keep from having one big .h file, i do not wish to declare all my classes in the .h file, thats what the .cpp is for? is it proper/normal programing to defile all the functions in the .h?
-
Template/class link errorFirst time useing templates and allthough they arnt needed im useing them to get used to templates. Im getting erros with i try to declare my key_table (the class) like key_table< apstring, int> kt; it give the error: error LNK2001: unresolved external symbol "public: __thiscall key_table< class apstring,int>::key_table< class apstring,int>(void)" (??0?$key_table@Vapstring@@H@@QAE@XZ) i dont have anything else in my main except for the statment: key_table< apstring, int> kt; i dont know why it would be complaing about it but if im using the templates wrong please correct me.
#include "assoc.h"
template< class S, class L> class key_table
{
public:
key_table();
key_table(const key_table< S,L> &table);int length(); bool empty(); void store(const S &target); bool get\_string(const S &target); //bool remove(const S &target); key\_table operator =(const key\_table< S,L> &table); protected: int table\_length; int current\_string; assoc< S,L> data\[MAX\_TABLE\_SIZE\];
};
#include "onetable.h"
#include template< class S, class L>
key_table< S,L>::key_table(){
table_length=0;
current_string=0;
}template< class S, class L>
key_table< S,L>::key_table(const key_table< S,L> &table){
table_length=table.table_length;for(int j=0;j< MAX\_TABLE\_SIZE;j++) data\[j\]=table.data\[j\];
}
template< class S, class L>
int key_table< S,L>::length(){
return table_length;
}template< class S, class L>
bool key_table< S,L>::empty(){
if(table_length==0)
return true;
else
return false;
}template< class S, class L>
void key_table< S,L>::store(const S &target){
int probe = 0;
bool found = false;L item=target.length(); assert(table\_length< MAX\_TABLE\_SIZE); assoc a(target, item); data\[table\_length+1\]=a; ++table\_length;
}
template< class S, class L>
bool key_table< S,L>::get_string(const S &item){
bool success=false;if(empty) success=false; else if(current\_string=table\_length) success=false; else{ current\_string++; item=data\[current\_string\].get\_string(); } return success;
}
-
Good Win32 resourcesHello, i am trying to begin in Win32 programing and wondering where some good win32 resources are to help begin in it (not books). And if you know a really good book on it please let me know, although im primarly looking for web (free resources) since i dont have $60+ to shell out. Also MFC but i think its a good idea to learn win32 before mfc.
-
Mode FunctionThe function has to find the mode (number most found in the array, for ex. array[]{1, 2, 1, 1} the mode is 1 since it appears 3 times in the array while 2 only apears once. movie is a class and it has a array of ints which movie.return_value(int) accesses. right now the mode equals the first number in the array, its like the second if isant getting evaluated right, anyway in my mind this should work and i cant find a way around it. void getmode(movie_data movie){ int numfound0=0, numfound1=0, mode=0, *num0ptr=&numfound0, *num1ptr=&numfound1, *modeptr=&mode; for(int j=0;j*num1ptr){ num1ptr=num0ptr; *modeptr=movie.return_value(j); } } } cout<<*num1ptr; movie.put_mode(modeptr); cout<