Here is a list of 250 C++ programs .I have made all the programs using Code Block IDE and compiled it using GNU GCC compiler. Compiling programs in any different compiler like Turbo C might give errors, so small changes are required but concept remains same.
BASIC C++ PROGRAMS
- C++ program to print "Hello World"
- C++ program to swap two numbers
- C++ program to convert Celsius to Fahrenheit and vice versa
- C++ program to check whether a given number is even or odd
- C++ program to convert time in Hours:Minutes:Seconds to seconds
- C++ program to find the area of triangle, rectangle,square and circle
- C++ program to calculate Simple and compound Interest
- C++ program to print multiplication table
- C++ program to check whether the given year is leap year or not
- C++ program to find the size of basic data types
- C++ program to find the roots of a quadratic equation
- C++ program to check whether the given number N is divisible by M
- C++ program to add two fractions
- C++ program to subtract two fractions
- C++ program to convert improper fraction to mixed fraction
- C++ program to convert centimeters to inches and feet
- C++ program to convert feet to inches
- C++ program to convert days into months and days
- C++ program to convert kilometres to miles
- C++ program to convert kilometre per hour to meter per second
- C++ program to convert time in seconds to hours, minutes and seconds
- C++ program to convert kilogram to pound and vice versa
- C++ program to convert degree to radian and vice versa
- C++ program to calculate power of a number
- C++ program to find factorial
- C++ program to find absolute value of a given number
- C++ program to calculate Body Mass Index
- C++ program to calculate distance between two points
- C++ program to calculate Greatest Common Divisor(GCD)
- C++ program to calculate Least Common Multiple(LCM)
- C++ program to simplify the given fraction
- C++ program to calculate Gross and net salary of an employee
- C++ program to calculate Grades
- C++ program to calculate income tax
- C++ program to find remainder
- C++ program to calculate profit and loss
- C++ program to calculate percentage
- C++ program to calculate PI, resistance and power
- C++ program to calculate square root of a number
- C++ program to calculate volume of a cylinder and sphere
- C++ program to calculate weighted arithmetic mean
- C++ program to check whether a date is valid or not
- C++ program to calculate generic root of any number
- C++ program to find largest digit of a number
- C++ program to guess a random number
- C++ program to swap nibble in a byte
- C++ program to find slope
- C++ program to find nCr
- C++ program to find nPr
- C++ program to check given number is prime or not
- C++ program to print the four digit numbers whose sum of squares of first half and second half are equal
- C++ program to check whether three points lies on one straight line
- C++ program to check whether a triangle is valid or not
- C++ program to find younger of Ram, Sham, Ajay
- C++ program to find the sum of all odd numbers from 1 to n
- C++ program to print first n positive integers that are divisible by x
- C++ program to find the largest of two numbers
- C++ program to add two numbers
- C++ program to check whether a given number is Armstrong or not
- C++ program to reverse a number
- C++ program to print digits of a number in words
- C++ program to find the sum of even numbers between 1 and n
- C++ program to print patterns
- C++ program to implement menu driven calculator
- C++ program to print days from Monday to Sunday corresponding to number 1 to 7
- C++ program to find largest of three numbers
- C++ program to find sum of digits in a given number
- C++ program to check whether a string is palindrome or not
- C++ program to find number of vowels in given string
- C++ program to find the number of consonants in a string
- C++ program to find the sum of first n natural numbers
- C++ programs on Fibonacci series
- C++ program to find the Average of n numbers
- C++ program to find largest number of array
- C++ program to check whether a number is positive or negative
- C++ program to find the sum of odd and even numbers separately
- C++ program to find the sum of odd & even positioned digits of a number separately
- C++ programs to find number of digits in a number
- C++ program to check whether the given input is alphabet or not
- C++ program to check whether a character is vowel or consonant
- C++ program to generate pyramid of numbers
- C++ program to print perfect square number between 1 to n
- C++ program to check whether the given number is perfect square or not
- C++ program to display Floyd's triangle
- C++ program to find nth term Arithmetic progression(AP) series and its sum
- C++ program to find nth term Geometric Progression(GP) series and its sum
- C++ program to find nth term Harmonic progression(HP)
- C++ program to check whether a given number is Adam number or not
- C++ program to check whether a given number is abundant number or not
- C++ program to find the sum of series
- C++ program to evaluate sine series
- C++ program to evaluate cosine series
- C++ program to print integers from 1 to n leaving values that are divisible by x
- C++ program to print numbers from 1 to n that are divisible by x and indivisible by y
- C++ program to print Adam numbers from 1 to n
- C++ program to print the abundant numbers from 1 to n
- C++ program to generate Arithmetic progression(AP) series
- C++ program to generate Geometric Progression(GP) series
- C++ program to generate Harmonic progression(HP) series
- C++ program to generate exponential series
- C++ program to generate logarithmic series
- C++ program to convert the string from upper-case to lower-case and vice versa
- C++ program to convert decimal to binary
- C++ program to convert decimal to octal
- C++ program to convert decimal to hexadecimal
- C++ program to convert binary to decimal
- C++ program to convert binary to octal
- C++ program to convert binary to Hexadecimal number
- C++ program to convert octal to decimal number
- C++ program to convert octal to binary number
- C++ program to convert octal to hexadecimal number
- C++ program to convert hexadecimal to decimal number
- C++ program to convert hexadecimal to binary number
- C++ program to convert hexadecimal to Octal number
- C++ program to convert decimal to Roman and vice versa
- C++ program to convert binary to Roman number and vice versa
- C++ program to convert octal to Roman number and vice versa
- C++ program to convert hexadecimal to Roman number and vice versa
- C++ program to convert ASCII value to character
- C++ program to convert character to different numeral systems
- C++ program to convert character string to binary
- C++ programs to demonstrate working of bitwise operators
- C++ program to set, reset, check, clear and toggle a bit
- C++ program to perform Circular Shift
- C++ program to toggle even bits
- C++ program to toggle odd bits
- C++ program to print all subsets of a set
- C++ program to print ASCII values of characters in a string
- C++ program to input a string from user
- C++ program to find length of string
- C++ program to concatenate two strings
- C++ program to sort list of names
- C++ program to check whether a sub string is present in a given string
- C++ program to print the characters at even and odd positions of a string
- C++ program to count number of words in a string
- C++ program to sort the characters in a given string
- C++ program to check whether a character is uppercase or lowercase
- C++ program to swap two strings
- C++ program to delete all vowels from a string
- C++ program to delete all consonants from a string
- C++ program to delete white spaces from string
- C++ program to delete a character from a string
- C++ program to replace a character with another character in string
- C++ program to print first and last character in a string
- C++ program to check whether the given two strings are anagram or not
- C++ program to print nth character of any given string
- C++ program to print escape characters
- C++ program to convert string to integer
- C++ program to convert string to float
- C++ program to count number of characters, vowels, consonants and white space in a string
- C++ programs based on frequency of characters in a string
- C++ program to remove duplicates of a character in a string
- C++ program to count number of times sub string appears in a string
- C++ program to count the number of upper-case and lower-case characters in a string
- C++ program to find the smallest and largest character in a string
- C++ program to insert character into the string at the given location
- C++ program to print ascii value of all alphanumeric characters
- C++ program to remove punctuation in a string
- C++ program to rotate a string
- C++ program to trim a string
- C++ program to insert a word in a string
- C++ program to remove sub string from given string
- C++ program to replace sub string with another string
- C++ program to remove a word from given string
- C++ program to replace a word with another word in given string
- C++ program to dynamically store n elements in an array
- C++ program to display array elements
- C++ program find sum and average of array elements
- C++ program to search an array elements
- C++ program to print element at given position in an array
- C++ program to insert an element at nth position in an array
- C++ program to delete an element at nth position in an array
- C++ program to swap two arrays
- C++ program to add two arrays
- C++ program to find address of elements in array
- C++ program to print first and last element of an array
- C++ program to print even, odd numbers in an array
- C++ program to copy one array to another
- C++ program to print the elements at the odd and even positions in an array
- C++ program to reverse an array
- C++ program to find smallest element in array
- C++ program to increment all array elements by n and print the resultant array
- C++ program to print unique elements in an array
- C++ program to delete an element at the given position in an array
- C++ program to sort an array
- C++ program to merge two arrays
- C++ programs based on frequency of elements in an array
- C++ program to check whether the given array is a subset of another array
- C++ program to rotate an array left/right by n places
- C++ program to split an array at the given position and move the second part to the front
- C++ program to find the maximum and minimum difference between two elements in an array
- C++ program to remove duplicates
- C++ program to find the union and intersection of two arrays
- C++ program to add two matrix
- C++ program to subtract one matrix from another matrix
- C++ program to multiply two matrices
- C++ program to find determinant of a matrix
- C++ program to check whether matrix is upper/lower triangular or not
- C++ program to find sum of diagonal elements of matrix
- C++ program to find smallest and largest element of matrix
- C++ program to to copy one matrix to another
- C++ program to check matrix is diagonal or not
- C++ program to check matrix is identity matrix or not
- C++ program to find transpose of a matrix
- C++ program to check whether a matrix is symmetric or not
- C++ program to solve simultaneous linear equation
- C++ program to find inverse of a matrix
- C++ program to perform chain multiplication of matrices
- C++ program to find nth power of a matrix
- C++ program to reverse a string
- C++ program to copy one string to another
- C++ program to print upper-case characters in a string using recursion
- C++ program to print lower-case characters in a string using recursion
- C++ program to implement binary search using recursion
- C++ program to print first n natural numbers using recursion
- C++ program to extract digits of a number using recursion
- C++ program to solve Tower of Hanoi
- C++ program to print address and value of a variable using pointer
- C++ program to illustrate pointer arithmetic
- C++ program to add/subtract constant value from a pointer
- C++ program to illustrate subtracting one pointer from another
- C++ program to pass array to a function using pointer
- C++ program to illustrate pointers and multidimensional array
- C++ program to pass multidimensional array to a function using pointer
- C++ program to print string using pointer
- C++ program to illustrate array of pointers to integers
- C++ program to print strings using array of pointers
- C++ program to invoke a function using pointer
- C++ program to compare two strings
- C++ program to find the sum of n numbers using pointers
- C++ program to illustrate function returning pointer
- C++ program to print address of an object using this pointer
- C++ program to illustrate function with no arguments and no return value
- C++ program to illustrate function with arguments and no return value
- C++ program to illustrate function with return value and no argument
- C++ program to illustrate function with arguments and return value
- C++ program to illustrate working of call by value method
- C++ program to illustrate working of call by reference method
- C++ program to find cube of a number using function
- C++ program to illustrate function overloading(square)
- C++ program to find sum of numbers using function overloading
- C++ program to print hello world using inline function
- C++ program to find greater of two number using inline function
- C++ program to find square of number using inline function
- C++ program to subtract two numbers
- C++ program to multiply two numbers
- C++ program to divide two numbers
#include // std::cout
ReplyDelete#include // std::string
#include
using namespace std;
int main ()
{
string d,c;
cout<<"ENTER YOUR PASSWORD"<>d;
int a=6;
std::string str (d);
std::size_t found = str.find_first_of("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,x,y,z");
while (found!=std::string::npos)
{
str[found]=a;
found=str.find_first_of("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,x,y,z",found+1);
}
cout<<"your encoded password is ";
//std::cout << str << '\n';
c =str;
cout<<c;
return 0;
}
can this code be used for encoding
hello
ReplyDelete