jonhdoe3.0
November 12th, 2002, 10:47 PM
how do i get and int. to accept only 2 numbers
|
Click to See Complete Forum and Search --> : getting and int to accept only 2 numbers jonhdoe3.0 November 12th, 2002, 10:47 PM how do i get and int. to accept only 2 numbers owenrb November 13th, 2002, 12:46 AM Tell us about your systems configuration first. Your platform and compiler. SolarFlare November 14th, 2002, 04:10 PM I'm not sure what you mean by this, but if you mean the user enters something like 3956 and you want the int to take 39, here's one way to do it: [code] cout<<"Enter an integer: "; int num; cin>>num; while(num>=100) { num/=10; } cout<<"The first two digits of your integer are: "<<num<<endl; codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |