Click here to Skip to main content
15,888,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to format numbers with dollar sign in a cell for a CListCtrl Pin
CPallini31-May-10 9:35
mveCPallini31-May-10 9:35 
GeneralRe: how to format numbers with dollar sign in a cell for a CListCtrl Pin
manchukuo31-May-10 11:13
manchukuo31-May-10 11:13 
GeneralRe: how to format numbers with dollar sign in a cell for a CListCtrl Pin
CPallini31-May-10 21:36
mveCPallini31-May-10 21:36 
QuestionRe: how to format numbers with dollar sign in a cell for a CListCtrl Pin
David Crow1-Jun-10 5:08
David Crow1-Jun-10 5:08 
AnswerRe: how to format numbers with dollar sign in a cell for a CListCtrl Pin
PJ Arends1-Jun-10 5:52
professionalPJ Arends1-Jun-10 5:52 
Question.:: How to convert a gotten int input into a char or string which each of their elements can be accessable separately? [C++] Pin
bijan.8k31-May-10 7:29
bijan.8k31-May-10 7:29 
AnswerRe: .:: How to convert a gotten int input into a char or string which each of their elements can be accessable separately? [C++] Pin
Luc Pattyn31-May-10 7:35
sitebuilderLuc Pattyn31-May-10 7:35 
AnswerRe: Try this code Pin
Software_Developer31-May-10 8:28
Software_Developer31-May-10 8:28 
Try this code.
It reads a number from CMD [For example: 1234].
Then puts each of its components in an array - digitArray[3]=1, digitArray[2]=2, digitArray[1]=3, digitArray[0]=4




   //         one                ten              hundred              thousand
   //          1                  2                  3                    4
   //digitn=digitArray[3]*1 + digitArray[2]*10 +digitArray[1]*100 +digitArray[0]*1000

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>


int digit=0,digitInput=0;
int digitArray[4]={0},digitn;
 
/*********************************
 *                               *
 ********************************/

void getIntKey(void)
{
   digitArray[0]=0;
   digitArray[1]=0;
   digit=0;
   digitInput=0;

   while((digit<4))
   {
	   if (kbhit())
	   {
		   digitInput=getch();
		 
		   if ((digitInput>47) && (digitInput<59))
		   {
	                 digitArray[digit]=(unsigned char)digitInput-48;
			 digit++;
			   
		   }
		   if (digitInput==13)  { digitn=digitArray[0]; break; }
	   }
   }
   if (digitInput!=13)  digitn=digitArray[3]*1+digitArray[2]*10+digitArray[1]*100+digitArray[0]*1000 ;
   printf("\n%i\n\n",digitn);
}

/*********************************
 *                               *
 ********************************/

int main()
{
	system("color 1F");     //Blue background       
   printf("This program by TopCoder requires you to input 4 digits  \n ");
   printf("Input Digits  (ex. 1=0001 , 1234=1234)  \n ");
   printf("\nInput Digits    >");
   getIntKey();
   
   printf("\ndigitArray[3]=%d \n",digitArray[3]);
   printf("digitArray[2]=%d \n",digitArray[2]);
   printf("digitArray[1]=%d \n",digitArray[1]);
   printf("digitArray[0]=%d \n",digitArray[0]);
   printf("\n%i\n\n",digitn);




	return 0;
}


..
GeneralRe: Try this code Pin
bijan.8k31-May-10 9:02
bijan.8k31-May-10 9:02 
GeneralRe: Try this code Pin
Software_Developer31-May-10 9:52
Software_Developer31-May-10 9:52 
GeneralRe: Now it is just clunky Pin
Software_Developer31-May-10 17:38
Software_Developer31-May-10 17:38 
GeneralRe: Now it is just clunky Pin
Luc Pattyn31-May-10 18:27
sitebuilderLuc Pattyn31-May-10 18:27 
AnswerRe: .:: How to convert a gotten int input into a char or string which each of their elements can be accessable separately? [C++] Pin
Aescleal31-May-10 10:29
Aescleal31-May-10 10:29 
QuestionRe: .:: How to convert a gotten int input into a char or string which each of their elements can be accessable separately? [C++] Pin
David Crow1-Jun-10 5:13
David Crow1-Jun-10 5:13 
QuestionBest way to open a HTML file from an URL Pin
Joschwenk66631-May-10 6:34
Joschwenk66631-May-10 6:34 
QuestionRe: Best way to open a HTML file from an URL Pin
David Crow31-May-10 7:13
David Crow31-May-10 7:13 
AnswerRe: Best way to open a HTML file from an URL Pin
Aescleal31-May-10 10:10
Aescleal31-May-10 10:10 
QuestionThe I/O Question of the network file or share file Pin
WanLiJun31-May-10 3:01
WanLiJun31-May-10 3:01 
AnswerRe: The I/O Question of the network file or share file Pin
KarstenK31-May-10 3:51
mveKarstenK31-May-10 3:51 
JokeRe: The I/O Question of the network file or share file Pin
Code-o-mat31-May-10 4:24
Code-o-mat31-May-10 4:24 
JokeRe: The I/O Question of the network file or share file Pin
KarstenK31-May-10 4:36
mveKarstenK31-May-10 4:36 
AnswerRe: The I/O Question of the network file or share file Pin
Aescleal31-May-10 9:59
Aescleal31-May-10 9:59 
Questionlibmms and ffmpeg Pin
rastaVnuce31-May-10 2:52
rastaVnuce31-May-10 2:52 
QuestionDLL Pin
john563231-May-10 0:03
john563231-May-10 0:03 
AnswerRe: DLL Pin
Cedric Moonen31-May-10 0:14
Cedric Moonen31-May-10 0:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.