Posts

Showing posts from July, 2019

How to make Simple Calculator in C

Image
// Performs addition, subtraction, multiplication or division depending the input from user build by Zahid Wadiwale # include <stdio.h> #include<windows.h> int main() {     SetConsoleTitle("Calculator Project - by Zahid Wadiwale");     char operator;     double firstNumber,secondNumber;     printf(" Zahid Calculator in C \n Enter an operator (+, -, *,/,): ");     scanf("%c", &operator);     printf("Enter two operands: ");     scanf("%lf %lf",&firstNumber, &secondNumber);     switch(operator)     {         case '+':             printf("%.1lf + %.1lf = %.1lf",firstNumber, secondNumber, firstNumber + secondNumber);             break;       ...

how to make a basic gui calendar in c without using graphics.h

Image
#include<stdio.h> #include<conio.h> #include<windows.h> struct Date{     int dd;     int mm;     int yy; }; struct Date date; struct Remainder{     int dd;     int mm;     char note[50]; }; struct Remainder R; COORD coord = {0, 0};  // sets coordinates to (0,0) as global variables void gotoxy (int x, int y) {         coord.X = x; coord.Y = y; // X and Y are the coordinates         SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); } //This will set the forground color for printing in a console window. void SetColor(int ForgC) {      WORD wColor;      //We will need this handle to get the current background attribute      HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);      CONSOLE...

How to make basic TicTacToe game in C

Image
/*   Tic Tac Toe game - tictacto.c   Author : Zahid Wadiwale   This is a simple Tic Tac Toe game. I have used conio2.h that is not a part of   the C standard and not available in Dev-C++ by default.   Please let me know if you find and error or if you have any questions.   I have also attached libconio.a , libconio_unicode.a and conio2.h   Enjoy! */ #include <stdio.h> #include <conio2.h> #include<windows.h> #define UPARROW     72 #define DOWNARROW   80 #define LEFTARROW   75 #define RIGHTARROW  77 #define ENTER       13 #define QUIT       'q' int _x,_y; //To track the position of the Tic Tac Toe frame being drawn //Function to show the Tic Tac Toe Frame void showframe(int posx, int posy) {   int hr=196, vr=179; // These are ascii character which display the lines   int crossbr=197; ...

How to make Simple Clock in C

Image
// C implementation of digital clock #include <stdio.h> #include <time.h> #include<windows.h> #include<resource.h> // driver code int main() {     SetConsoleTitle("Clock Project - by Zahid Wadiwale");     time_t s, val = 1;     struct tm* current_time;     // time in seconds     s = time(NULL);     // to get current time     current_time = localtime(&s);     // print time in minutes,     // hours and seconds     printf("%02d:%02d:%02d",            current_time->tm_hour,            current_time->tm_min,            current_time->tm_sec);   return 0; }

Basic Addition program in c

Image
#include <stdio.h> main () {     int num1, num2 , sum;     printf("enter the two integer values to be added");     scanf ("%d %d", &num1 ,&num2);     sum=num1+num2;     printf("addition of %d and %d = %d \n", num1 , num2 ,sum); }

Opening Programs in C

#include <unistd.h> #include <stdio.h> int main(void) {  char* prog[3];  prog[0] = "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe";  prog[1] = "http://zahidserver.runhosting.net";  prog[2] = '\0';  execvp(prog[0], prog); }

Name Age program in C

#include<stdio.h> #include<windows.h> int main() {     SetConsoleTitle("Name and Age - by Zahid Wadiwale");     int a;     char ar[50];     printf("enter name \n");     scanf("%[^\n]",&ar);     printf("enter age \n");     scanf("%d",&a);     printf("your name is %s and age is %d \n",ar,a);     return 0; }