#include<iostream>
#include<stdlib.h>
using namespace std;
int readInt()
{
int cc=getc(stdin);
for(;cc<'0'||cc>'9';)
cc=getc(stdin);
int ret=0;
for(;cc>='0'&&cc<='9';)
{
ret=ret*10+cc-'0';
cc=getc(stdin);
}
return ret;
}
int main(void)
{
int p=readInt();
cout<<p<<endl;
return 0;
}
Yogesh_9
0
Newbie Poster
Recommended Answers
Jump to PostJust so you know, the proper C++ version of that (mostly C-style) code is this:
#include<iostream> using namespace std; int main(void) { int p = 0; cin >> p; cout << p << endl; return 0; }
That readInt function just reads an integer for the …
All 3 Replies
NathanOliver
429
Veteran Poster
Featured Poster
Yogesh_9
0
Newbie Poster
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.