Home

On Tue, 02 Oct 2007 15:45:25 -0000, curiousEngine
<curious.engine@gmail.com> wrote in comp.lang.c++:

> Write a program to print out the integers from 40 to 127 in decimal,
> octal,
> hexadecimal and also print out the equivalent character.
> ************************************/
> #include<iostream>
> using namespace std;
>
> void main(){

Change the above to "int main()", which makes your program actual,
legal C++, as required by the language standard. Specifying a return
type for main() other than int makes the program ill-formed.

> for (int i(40); i <= 127; i++){
> cout<<"Decimal Value:"<<i;
> cout<<"Octal Value:"<<oct<<i<<endl;
> cout<<"Hexadecimal Value:"<<hex<<i;
> cout<<"Character:"<<char(i);
> }
> }
>
> how to refactor the above code?

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html

previous
next

Re: the one python book
Re: Question about objects
Call for Paper: ICSR 10
Re: conversion warning
Re: Resource in static library
Szkoły policealne technik bhp
turystyka światowa
andrzej dąbrowski
blog
okna lubin