Tag Archives: C++
Different methods of swapping 2 numbers
#include<stdio.h> void swap(int *,int *); int main() { int temp; int *t; int a=100,b=200; //Using 3 variables //1.1 temp = a; a = b; b = temp; printf(“%d %d\n”,a,b); //1.2 swap(&a,&b); printf(“%d %d\n”,a,b); //Using 2 variables //2.1 a += b; … Continue reading
Errors in “Hello World” program
#include<stdio.h> int main() { printf(“Hello World”); return 0; } /* Errors Line 1 :- *1. If u remove only preprocessor (#)->error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token *2.#nclude<stdio.h> -> error: invalid preprocessing directive #nclude *3. #include … Continue reading
Quick Sort using recursion
//Quick sorting using Recursion #include<stdio.h> #include<stdlib.h> //Prototypes of functions used int * input(int *,int); int * sort(int *,int); void display(int*,int); int main() { int *a,n; printf(“Enter number of numbers you want to sort?\n”); scanf(“%d”,&n); a = input(a,n); a = sort(a,n);//call … Continue reading
Bubble sorting using recursion
#include<stdio.h> #include<stdlib.h> int * input(int *,int); int * sort(int *,int); void display(int*,int); int main() { int *a,n,i,j,c,temp; printf(“Enter number of numbers you want to sort?\n”); scanf(“%d”,&n); a = input(a,n); a = sort(a,n); display(a,n); } int * input(int *a,int n) { … Continue reading
multiple data decompression for codelength 4
RCS file: header.h,v Working file: header.h head: 1.1 branch: locks: strict root: 1.1 access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: All required headers are included. —————————- revision 1.1 locked by: root; date: 2015/07/08 … Continue reading
C++ : simple program in linux.
RCS file: ./simple.cpp,v Working file: ./simple.cpp head: 1.1 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 1; selected revisions: 1 description: printing “My name is Ruchi”using string mystring —————————- revision 1.1 date: 2014/06/06 12:46:39; author: root; … Continue reading