Professional Documents
Culture Documents
CS214: Programming Fundamentals: Sections: A, B, C
CS214: Programming Fundamentals: Sections: A, B, C
Assignment
Solo Group Quizbased
Type
Submission
Online Inclass Either
Type
Follow guidelines
Submission 1. Filename must be
1. Attach this cover for the submission
Guidelines i<ROLL#> followed
page. type checked.
by the suffix.
2. Only use A4size
(Read under 2. Submit .cpp, .jpeg, Any submission
blank white paper
Submission etc. in the
(70g). attempted < 70%
Type designated SLATE
3. Staple all pages. is not marked for
Column) folder in
4. Due at class start. credit.
Assignments tab.
ImportantNotes:
Completetheprogramskeletongivenbelow:
#include<iostream>
#include<string>
usingnamespacestd;
intmain()
{
intdecimal=0;
stringbinary;
stringhex;
//Youaresupposedtotakethesenumbersfromtheuser
cout<<"Thebinaryvalueof"<<decimal<<"is"<<decimalToBinary(decimal)<<endl;
//previouslywasinsideifstatement
cout<<"Thehexvalueof"<<decimal<<"is"<<decimalToHex(decimal)<<endl;//previously
wasinsideifstatement
if(validBinary(binary))
{
cout<<"Thedecimalvalueof"<<binary<<"is"<<binaryToDecimal(binary)<<endl;
}
else
cout<<"Invaldbinaryvalue"<<endl;
if(validHex(hex))
{
cout<<"Thedecimalvalueof"<<Hex<<"is"<<hexToDecimal(hex)<<endl;
}
else
cout<<"Invaldhexvalue"<<endl;
return0;
}
NOTES:
1. ThefunctionvalidBinary(binary)checksthevalidityofthebinaryinputtakenfromuser
(i.e.itshouldonlyhave0or1).
2. ThefunctionvalidHex(hex)checksthevalidityofthehexinputtakenfromuser(i.e.it
shouldonlyhavenumbersfrom09andalphabetsfromAF).