Monday, November 13, 2017

Add/Sum two numbers using pointers in C/C++ Language

1 comments
Problem Take two integer inputs from user. Create Sum function which should receive two integers using pointers. Calculate the sum and display the result in main function. Code #include "stdafx.h" #include <iostream> #include<conio.h> using namespace std; int sum (int *, int *); int main() { int a,b,c; cout << "Enter 1st number: "; cin >> a; cout<<"enter 2nd number: "; cin >> b; c = sum (&a,&b); ...
Read More..

Saturday, November 4, 2017

Calculate Square of 3 input integers using function and pointers

0 comments
Problem Write a program to calculate square of an integer, input by the user. Declare a function with the name of square and should receive 3 integers. The function should then calculate the square of these three integers and return the square. Display the result. Code #include "stdafx.h" #include <iostream> #include<conio.h> using namespace std; void square (int *, int *, int *); int main() { int a,b,c; cout << "Enter...
Read More..

Sunday, October 15, 2017

Display Add/Sum of two integers in C Language

0 comments
Problem Write a program in C language which takes two integers as input from user. Write a function to add these two integers and store the sum in another integer. Display the result. Code // lab02..cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include<conio.h> using namespace std; int sum (int, int); int main() { int a,b,c; cout << "Enter 1st number: "; cin...
Read More..

Saturday, October 7, 2017

Date Sum Using Structure in C/C++ Language

0 comments
Problem Create a struct called data. User should be able to input day, month, and year. Take two date inputs and add them. Display the result. Code #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> //struct decleration struct data { int years; int months; int days; }d1,d2; //function protorypes void add_data(); void add_dates(); void display(int ,int ,int); int main() {  ...
Read More..

Sunday, October 1, 2017

Time Sum Using Structure in C/C++ Language

1 comments
Problem Create a structure called time. Its three members, all type int, should be called hours, minutes, and seconds. Write a program that prompts the user to enter a time value in hours, minutes, and seconds. This can be in 12:59:59 format, or each number can be entered at a separate prompt (“Enter hours:”, and so forth). The program should then store the time in a variable of type struct time, and finally print out the total number of...
Read More..

Sunday, September 24, 2017

Input Length and Breadth. Calculate Area and Perimeter Using Struct in C Language

0 comments
Problem: Write a program which takes length and breadth as input. Than calculate area and perimeter of the room. Code #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> struct distance{ int length; int width; }; struct room{ struct distance a; }r; void myftn(); int main() { myftn(); printf ("\n\nPress any key to exit."); getch(); return 0; } void myftn () { int p,s; ...
Read More..

Sunday, September 17, 2017

Convert Fahrenheit to Celsius | Convert Celsius to Fahrenheit

0 comments
Problem Write two functions in a program of C language to convert: Function 1: Fahrenheit to Celsius Function 2: Celsius to Fahrenheit Code #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> void ftoc(); void ctof(); int main() { ftoc();         ctof();      printf ("\n\nPress any key to exit."); getch(); return 0; } void ftoc() { ...
Read More..

Copyright 2017. All Rights Reserved. Privacy Policy / Terms And Conditions / Sitemap / Contact