I am student, taking C programming now.
I have assignment to write function to check if inputed data is numbers. if not - it should write that, and ask to enter number again.
I wrote code, to write error message, but dont know how to make program to work on next input.. should I call the Main function again ?
double hours; //hours worked in a week
double payrate; // hourly salary
double grosspay; //total weekly payment
int k; //number of values read
printf ("Enter number of hours, and hourly pay (or press 0 to exit) \n");
while ((k = scanf ("%lf%lf", &hours, &payrate))==2)
if (isdigit(hours) !=0)
printf ("You entered invalid data, please enter number of hours \n");
if (isdigit(payrate) !=0)
printf ("You entered invalid data, please enter payrate \n");
You cannot use a double parameter as input to the isdigit()[^] function. You should read your numbers in as strings and then apply isdigit() to each character, using a loop. Rather than having all your code in the main() function, you may want to think about writing a helper function that will input the string, validate it and return the converted value.
One of these days I'm going to think of a really clever signature.
int main( )
char n ;
int no = 0 ;
printf("Enter a no " );
while( (n = (char)getche( )) != '\r') //Check for enter key
if( n >= '0' && n <= '9' )
n = n - 48 ;
no = (no * 10) + n ;
printf("\n %d " , no ) ;
return 0 ;
i,m astuedent in university ,and my doctor want from every
student aproject ,and i want code to make from that (requirement,design,and testing)
please send me code by c++ language such as about
how identification digit system works
I think what your teacher wants is for you to develop the project yourself.
Pick a topic.
Read up on it. (Google is a good place to start.)
Get working on it.
If you have some specific problem with some detail, come back here and ask a question.
We are not in the business of writing your project for you.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
When I am designing a dialog box with static text boxes to display numbers can I initialize control variables as arrays through the wizard?
As an example, say I am collecting information in 8 channels and would like to display this information in a 8 separate text boxes. I want to store the information in the variable int m_chan but I don't see the array option in the 'Add Variable...' in VS2010.
The wizard is limited; you should get used to skip the wizard. Many times it's even faster to add something to your code, than using the wizard. What you want is possible (as shown already), but not with the wizard.
I have created a win32 dll(VC++). And I know the appropriate .net assembly file which contains the required methods.
I want to access those methods from my DLL.
I came to know , it can possible through C++/CLI interface.
But i'm very new to C++/CLI . So kindly help me to create such interface in C++ which can access those methods using certain assembly/any way.
If have any any sample example (running),then please share me soon. I tried a lot in google , but till now i didn't get any helpful samples .