Purchase Solution

Recognize Digit String Surrounded by Optional White Spaces

Not what you're looking for?

Ask Custom Question

Char line [MAXLINE];
int error,;
do {
printf("Input a positive integer: ");
fgets(line, MAXLINE,stdin);
error=sscanf(line,"%d",&n) !=1II n<=0;
if(error)
printf("|nERROR:Do it again.n");
} while(error);

Purchase this Solution

Solution Preview

I assume that you do it in C (so the code looks).

An example of how to modify the code to do what you request is given below.

In case you do it in Visual Studio, I also attach a whole VS6 project in the zip file (it can easily be modified for VS7 and VS8, if needed).
It is worth to look into it in any case, as some of the characters used in ...

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Javscript Basics

Quiz on basics of javascript programming language.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.