Read from file negative numbers C++ -


i have numbers file , of them negative. so, how can that? (c++)

now i'm trying (without special):

u1.txt file:

4 5 -1 6 -2 

my code:

ifstream fd(fd); int n1,n2,n3,n4,n5; fd>>n1>>n2>>n3>>n4>>n5; 

your code correct, except typo n4 missing. this:

ifstream fd("u1.txt"); int n1,n2,n3,n4,n5; fd>>n1>>n2>>n3>>n4>>n5; 

will expect, modulo error conditions.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -