Skip to content

Instantly share code, notes, and snippets.

View karthikkondagalla's full-sized avatar

Karthik K karthikkondagalla

  • DeKalb, Illinois
View GitHub Profile
@karthikkondagalla
karthikkondagalla / string.cc
Created August 27, 2017 05:07
Manual String class implementation in C++
#include "String.h"
#include <cstring>
#include <cstdlib>
const size_t String::npos=-1;// greatest possible value for type size_t
/******************************************************
Function: String
Arguments: None
Description: Default constructor
Return: Nothing
*******************************************************/
@karthikkondagalla
karthikkondagalla / grocery.cc
Created August 27, 2017 05:02
Grocery Store Simulation Model in C++
#include "grocery.h"
int main()
{
int seed = time(0);
srand(seed);
event e;
L l;
Q q;
stat s;
int i=1,clock = 0;
@karthikkondagalla
karthikkondagalla / nqueens.cc
Created August 27, 2017 05:01
N Queens Program in C++
#include "nqueens.h"
int main()
{
int N;
cout<<"Enter N value :";
while(cin>>N)
{
solveNQueens(N);//function call for the solveNQueens function.
}
return(0);
@karthikkondagalla
karthikkondagalla / calculator.cc
Created August 27, 2017 04:57
Calculator Program in C++
#include "calculator.h"
int main()
{
string token;
stack<double> S;
while(getline(cin, token))
{
process_token(token, S);//function call for the process_token function
}
return(0);
@karthikkondagalla
karthikkondagalla / ball.cc
Created August 27, 2017 04:55
Ball Game Simulation in C++
#include<iostream>
#include<vector>
#include<cstdlib>
#include<ctime>
#include "ball.h"
vector<vector <bool> > traps(GRID_SIZE, vector<bool>(GRID_SIZE));
vector<unsigned> ballCycles;
int main()
{
unsigned B_air = 1;//Balls in air
@karthikkondagalla
karthikkondagalla / Date.cc
Created August 27, 2017 04:51
Date Validation Program in C++
#include "/home/cs689/common/689.h"
#include "Date.h"
const string defaultMonth = "January";//This global constant string variable is used for default month
const int defaultDay = 1;//This global constant integer variable is used for default day
const int defaultYear = 1900;//This global constant integer variable is used for default year
/*
This is the deafault constructor
*/
Date::Date()
@karthikkondagalla
karthikkondagalla / error.cc
Created August 27, 2017 04:45
C++ program to remove comments from a file
#include<iostream>
#include<string>
#include "error.h"
#include "/home/cs689/common/689.h"
/****************************************************************
FUNCTION: error
ARGUMENTS: string