Skip to content

Instantly share code, notes, and snippets.

View sprintr's full-sized avatar
🎯
Focusing

Amin Ullah sprintr

🎯
Focusing
View GitHub Profile
@sprintr
sprintr / c2fconverter.cpp
Created January 26, 2013 12:42
This is a simple command line Celsius to Fahrenheit converter
#include <iostream.h>
void main(void)
{
int c = 0, f = 0;
cout << "Enter the temprature in C: ";
cin >> c;
f = c * (9/5) + 32;
@sprintr
sprintr / squareof1st10numbers.cpp
Created January 26, 2013 12:47
Using for loop takes the square of first 10 numbers
#include <iostream.h>
void main(void)
{
int i;
for(i = 1; i <= 10; i++)
cout << "Square of " << i << ": " << i * i << endl;
}
@sprintr
sprintr / usingswitchstatement.cpp
Created January 26, 2013 12:54
Using switch, case, break, default!
#include <iostream.h>
void main(void)
{
cout << "1 - Calculate the area of a room: " << endl;
cout << "2 - Convert age into seconds: " << endl;
cout << "3 - Convert Celcius into farenhiet: " << endl;
cout << "4 - Exit" << endl;
int choice = 0;
@sprintr
sprintr / Fibonacciseries.cpp
Created January 26, 2013 13:07
Prints Fibonacci series
#include <iostream.h>
void main(void)
{
int numberTerms = 0, fNumber = 0, sNumber = 1, nNumber = 0;
cout << "Enter the number of terms: " << endl;
cin >> numberTerms;
cout << "The terms in this series: " << endl;
@sprintr
sprintr / areaofaroom.cpp
Created January 26, 2013 13:09
Calculates and prints the area of a room
#include <iostream.h>
void main(void)
{
int width, length, area;
cout << "Enter the width of the room: " << endl;
cin >> width;
cout << "Enter the length of the room: " << endl;
@sprintr
sprintr / ageintoseconds.cpp
Created January 26, 2013 13:11
Age into seconds calculator
#include <iostream.h>
void main(void)
{
int age = 0, ageInSeconds = 0;
cout << "Enter your age: " << endl;
cin >> age;
ageInSeconds = age * 365 * 24 * 60 * 60;
@sprintr
sprintr / dowhile.cpp
Last active December 11, 2015 18:38
An example of do while
#include <cstdlib>
#include <iostream>
using namespace std;
// standard c++
int main(int argc, char *argv[])
{
// even if (choice = 'N'), do will run once
char choice = 'Y';
@sprintr
sprintr / basicHTML.html
Created January 28, 2013 10:44
Basic HTML Tags
<html>
<head>
<title>My First Page</title>
</head>
<body>
<ol type="i" start=3>
<li><font face="verdana" size=2>Syed Hizbullah</font></li>
<li><font face="arial" color="#ff0000">Muheeb Ullah</font></li>
</ol>
@sprintr
sprintr / bubblesort.cpp
Created February 10, 2013 17:09
The simplest bubble sorting example in cpp!!!
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int list[]={9, 1, 4, 2, 8};
int i, j;
#include <iostream>
#include <string>
using namespace std;
class Circle {
private:
double radius;
string color;