Skip to content

Instantly share code, notes, and snippets.

@krysseltillada
krysseltillada / date.cpp
Last active October 17, 2021 05:51
c++ date class
//update:
/// this is just some exercise code in the book i study so i thought it could be useful to some people about the methods in the code
/// changes:
/// added:
/// class operator function Date operator(Date&) - with this you can now assign a date object to another date object
/// class JulianDate: methods ->> object.jdatedisplay() - displays the julian date
//// ->> object.Date(); - converts and diplays the julian date to gregorian date
/// ->> overloaded constructor -> JulianDate(int month, int day, int year); expects to have the values
//// and converts to julian date
///
@krysseltillada
krysseltillada / polartocartesian.cpp
Last active September 17, 2020 09:08
polar to cartesian converter
/// this is just some code snippets i do in some exercise in the book i'vs studied i thought it could be useful to some people
/// about this class
/// object.CoordDisplay(); - displays the converted values
/// object.conToCartesian(); - converts the following argument values into cartesian values
/// you can edit this code if you want
//// declare a class Coord before using one of the class methods..
#include <iostream>
#include <cmath>
@krysseltillada
krysseltillada / employee.cpp
Last active August 29, 2015 14:17
employee data info storing program
/// just a small exercise program in c++ book that i study so if anyone encounters the same problem this
/// this program i created will do its job according to the problem
/// expect that when to input a invalid number the program will have infinite loop
#include <iostream>
#include <string>
using namespace std;
class Employee
@krysseltillada
krysseltillada / foodtypeprogram.cpp
Created March 24, 2015 16:23
a food type info storing exercise program in c++
/// a food type info storing exercise written in c++
/// if some peole encounter a exercise problem like this it may be helpful
/// this program will do its job properly according to the problem given
#include <iostream>
#include <string>
#include <algorithm>
@krysseltillada
krysseltillada / datastruct.cpp
Last active August 29, 2015 14:18
a simple c++ data structure class
///simple data structure program --> a simple exercise program from the book i've been study it might help to some people :D
//// for class Studentrecord --> methods
/// object.display(); - displays the values in the object :: expects no argument
/// object.setIdnum(int); - sets the id number :: expects a integer value argument
/// object.setCredits(double); - sets the credits value :: expects a double or integer value argument
/// object.setGradeave(double); - sets the average grade :: expects a double or interger value argument
//// for class Studentinfo --> methods
/// object.display(); - displays the values in the object :: expects no argument
/// object.setStudentname(string); - sets the name of the student :: expects a string argument
/// object.setDate(int, int, int); - sets a date :: expects a three integer argument
@krysseltillada
krysseltillada / email_val.cpp
Created April 26, 2015 13:15
email address validator
#include <string>
#include <iostream>
using namespace std;
bool chck_email(string);
int main()
{
string str;
@krysseltillada
krysseltillada / rpsg.cpp
Created May 1, 2015 16:43
rock, paper ,scissors game
#include <iostream>
#include <string>
#include <vector>
int main()
{
vector<int> comp = {1 , 3, 2, 1, 2, 3, 1, 1, 2, 3};
vector<string> attacks = { "rocks", "paper", "scissors" };
string decided_atk = "none", user_decided_atk = "none", results = "none";
int user_input = 0, rounds = 0, counter = 0, user_points = 0, ai_points = 0;
@krysseltillada
krysseltillada / mwd.cpp
Created May 2, 2015 17:26
most words detector
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <numeric>
using namespace std;
int main()
{
@krysseltillada
krysseltillada / fng.cpp
Created May 5, 2015 19:17
fibonacci number generator
#include <iostream>
int main()
{
int num1 = 1, num2 = 1, max_num = 0, sum = 0, counter = 0;
cout << "enter a number of values to generate a fibonacci numbers: ";
cin >> max_num;
cout << num1 << endl
<< num2 << endl;
@krysseltillada
krysseltillada / tsn.cpp
Created May 8, 2015 13:56
tracking a smallest number in a loop
#include <iostream>
int main()
{
int curr_num = 0;
for(int n = 50; n <= 100; n++) {
if(curr_num == 0) {
curr_num = n;
}