c - Why does my code not return anything? -


It appears that an entry like:

 1 1 524 5 Truth-1  

Where the first parameter is idOrder , the second parameter has the number of idOrder products, the third parameter is a code, the fourth parameter is the quantity of the product, the fifth parameter distinguishes the product To do is a bullion and the sixth parameter is the last mark.

It should return an output such as:

 524 -15  

Where the first parameter is the code of the product, the second parameter is the last mark and the third parameter is the product Is the quantity.

This is my code:

  #include & lt; Stdio.h & gt; typedef enum {false, true} bool; Int main () {const int = -1; Int Idear, Nain Products, IDCodproduct, Zodiac, Total, Temporary; Bull Generic, Endsak; scanf ("% d", floating); / * Printf ("% d", floating); * / IdOrder = temp; endSeq = temp == END; If (and SEC! = True) {total = 0; Scan ("% d", and temporary); NumProducts = temp; Scan ("% d", and temporary); IdCodeProduct = temp; Scan ("% d", and temporary); Zodiac = temporary; Scan ("% d", and temporary); Normal = temporary; If (general == true) {total = total + amount; Printf ("% d", idCodeProduct); }} Printf ("% d", END); printf ("% d", total); Return 0; }   

When I run this code, it does not return anything and why I do not know. The problem is that you have a white space in the formatted code in the back where scanf < / code> However this is the reason for reading scanf to read and discard white space, as long as it is a non- Whitespace can not be found If there is nothing else to read, then scanf will wait indefinitely for more input.

Drop backwards in the format and it should work better. Unless you are scanning for normal strings or numbers, you have to remember that scanf actually automatically leaves the leading whitespace.

I suggest that for example.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -