Category Archives: C++

Bubble Sort C++

/* *bubblesort.cpp * * Created on: May 28, 2017 * Author: asharda */ #include<iostream> using namespace std; void bubblesort(int arr[],int size) { int temp; for (int i=0;i<size;i++) { for (int j=i+1;j<size;j++) { if(arr[i] >arr[j]) { temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; }//end of … Continue reading

Posted in C++, Data Structures, Uncategorized | Leave a comment

Functions and Arrays in C++

/* * arraysis.cpp * * Created on: May 28, 2017 * Author: asharda */ #include<iostream> using namespace std; void printarr(int arr[],int size) { for (int i=0;i<size;i++) { cout<<arr[i]<<“\n”; } } int main() { int arr[]={1,2,3,4,5}; printarr(arr,5); }

Posted in C++, Uncategorized | Leave a comment

Basic String Functions C++

/* * stringfunctions.cpp * * Created on: May 02, 2017 * Author: asharda */ #include<iostream> #include<cstring> using namespace std; int main() { char str1[10]=”Hello”; char str2[10]=”C++”; char str3[10]; //Copy Str1 in Str3 strcpy(str3,str1); cout<<str3<<“\n”; //Concatenate Str2 to Sr3 strcat(str3,str2); cout<<“Concatenated … Continue reading

Posted in C++ | Leave a comment

Print Hello C++

#include<iostream> using namespace std; int main() { char greeting[]={‘H’,’e’,’l’,’l’,’o’,’\0′}; cout<<greeting; }

Posted in C++, Uncategorized | Leave a comment

Find the area of the Rectangle -C++

/* * Rectangle.cpp * * Created on: Jan 29, 2017 * Author: asharda */ #include <iostream> using namespace std; class Rectangle { int width,height; public : void set_values(int ,int); int area(); }; /** * Set the values of the Rectangle … Continue reading

Posted in C++ | Leave a comment

Find Max between 2 numbers

//============================================================================ // Name : testcpp.cpp // Author : asharda // Version : // Copyright : Your copyright notice // Description : Find max between 2 numbers C++, Ansi-style //============================================================================ #include <iostream> using namespace std; int main() { cout<<“\n”<<“Max between both … Continue reading

Posted in C++ | Leave a comment

Getting Started with C/C++ on Windows

(1)First download http://www.mingw.org/ (2)Add /Update the Path by pointing to the bin location. (3)Download Eclipse Editor for C/C++. (4)Create a new C/C++ project Hello World. (5)Before running the code,Build the project and then right click on the file and run as … Continue reading

Posted in C++, Uncategorized | Leave a comment