The trouble is you think you have time. Your success depends on how you utilize your time.
Showing posts with label C plusplus Programs. Show all posts
Showing posts with label C plusplus Programs. Show all posts

C++ program to make a snake game in console application

How to make a snake game in C plus plus which can be played in the console screen.

This c++ program will create the following snake game. You will be able to play this game using your A, W, S, D buttons of keyboard.


#include<iostream>
#include<conio.h>
#include<Windows.h>
using namespace std;
bool gameOver;
const int width = 20;
const int height = 20;
int x, y, fruitX, fruitY, score;
int tailX[100], tailY[100];
int nTail;
enum eDirection { STOP = 0, LEFT, RIGHT, UP, DOWN };
eDirection dir;

C++ program to print result card | obtained marks | percentage | grade using if statement

C plue plus program to print result card obtained marks, percentage, and grade using cout, cin and if statements.

#include<iostream>
using namespace std;
int main()
{
int sum,per,eng,urdu,math,isl,phy,che,TotalMarks;
cout<<"\n\tStudent Result Card\n";
cout<<"=================================="<<endl;

cout<<"Enter marks in English: ";
cin>>eng;

How to find date and time in C++ easiest way

To find date and time in c plus plus you have to use a header file known as windows.h
When you will include this you will be able to use a function known as getlocaltime() as well as a class Systemtime. Now you just have to create an object of SYSTEMTIME class and call getlocaltime function and pass the address of the object in this function and all the data will be stored about time and date in the object. Now you just have you use the date. Following is the example:

#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
  SYSTEMTIME obj;

C++ Program which will give the sum of two complex numbers by taking imaginary and real part as input using classes and objects

How to write a C++ Program which will print the sum of two complex numbers by taking imaginary part and real part as input using classes and objects.

#include <iostream>
using namespace std;

class Imagin{
public:

double x,y;

Imagin(double nx, double ny){

x=nx;y=ny;}
};

C++ Program which will takes the marks of 5 subjects and print the percentage and grade.

Write a C++ Program which will take the marks of five subjects as input and take the total marks as well and print the percentage and grade.

#include<iostream>
#include<conio.h>


using namespace std;
int main()
{
cout<<"www.moznum.blogspot.com"<<endl<<endl;

     float x=0,eng=0,pf=0,be=0,ict=0,isl=0,aggregate=0,total=0,obtained=0,percent=0;

C++ Program that converts Celsius to Fahrenheit and Fahrenheit to Celsius by taking input and print them

C++ Program that converts Celsius to Fahrenheit and Fahrenheit to Celsius by taking input and print them.

#include<iostream>
#include<conio.h>

using namespace std;
int main()
{
      int c,Cel,f,Fah;

C++ program to find the solution of a number of some power by taking base and exponent as input

How to solve a number have some exponent on its base by taking exponent and base as input in C++.

using namespace std;
#include <iostream>
#include <math.h>
int main()
{
cout<<"www.moznum.blogspot.com"<<endl<<endl;

C++ Program to Find the factorials of a number and Print them by taking number as Input

How to Print factorials of a number in C++

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
cout<<"www.moznum.blogspot.com"<<endl<<endl;

int i,n,c=1;

C++ Program to Print that a number is composite number or a prime number and also print the factors of that number which is taken by input.

How to write a C++ program that prints the factors of the number and also prints that a number is a prime number or a composite number by taking the number from the user.

using namespace std;
#include<iostream>
int main()
{
cout<<"www.moznum.blogspot.com"<<endl<<endl;

C++ Program to find the factors of a number which is taken by input and print it


How to find the Factors of a number which will be taken by the user and will print on screen in C++.

#include <iostream>
#include <conio.h>

using namespace std;
int main()
{
cout<<"www.moznum.blogspot.com"<<endl<<endl;

C++ Program to Print multiplication tables of a number by taking input to desire number.


Write a C++ to print Multiplication table of a number by taking Input and print them to the desire number :

using namespace std;
#include<iostream>
#include<conio.h>
int main()
{
cout<<"www.moznum.blogspot.com"<<endl<<endl;

C++ Program to take a number as an input and print all the numbers in sequence to that number also print odd, even and square in sequence separately

Write a C++ Program to take a number as an input and print all the numbers in sequence to that number also print odd numbers, even numbers and square of the numbers in arrays separately.

#include<iostream>


using namespace std;

int main()
{
cout<<"[www.moznum.blogspot.com]"<<endl<<endl;

C++ program to find Centripetal force by taking mass velocity and radius as an input and print it.

Write a C++ program to calculate Centripetal force by taking input of mass , velocity and radius and print it.


#include<iostream>
using namespace std;
int main()
{ cout<<"www.moznum.blogspot.com"<<endl<<endl;

C+ Program to take inputs in two arrays Array A and B and make third array C in which even numbers form both arrays get store in third array C from left to right and odd number from right to left.

C+ Program to take inputs in two arrays Array A and B and make third array C in which even numbers form both arrays get store in third array C from left to right starting from 1st index and odd number from right to left starting from last index.

#include<iostream>
using namespace std;
int main ()
{ cout<<"[www.moznum.blogspot.com]"<<endl<<endl;

Add two Numbers using Classes and Objects, with the help of Functions.


How can we add Two numbers Using Classes and Objects, and also print them through class in C++:


#include<iostream>
#include<conio.h>
using namespace std;

class complex
{
private:
int a, b,c;
public:
int add(int x,int y)

C++ Program which copy all even numbers from first Array A to third Array C from left to right and copy all odd numbers from right to left and do this same thing for the second Array B and copy it into third Array C.


Given two arrays of integers A and B of sizes M and N respectively. Write a C++ program which will produce a third array named C. Such that the following sequence is followed.
a. All even numbers of A from left to right are copied into C from left to right.
b. All odd numbers of A from left to right are copied into C from right to left.
c. All even numbers of B from left to right are copied into C from left to right.
d. All odd numbers of B from left to right are copied into C from right to left.



#include<iostream>
using namespace std;
int main ()
{ cout<<"[www.moznum.blogspot.com]"<<endl<<endl;