Posts
Java fundamentals-1
- Get link
- X
- Other Apps
By lakahman malviya
lakshmankablog
projectstu.h of student management system header file
- Get link
- X
- Other Apps
By lakahman malviya
lakshmankablog
#include<dos.h> void displayTime(){ struct time curtime; gettime(&curtime); printf("\t\t%02d:%02d:%02d",curtime.ti_hour,curtime.ti_min,curtime.ti_sec); } void displayDate(){ struct date today; getdate(&today); printf("\n%02d/%02d/%04d",today.da_day,today.da_mon,today.da_year); } int countStudent() { FILE *fp; int n,last; fp=fopen("student.dat","rb");//open file in binary mode fseek(fp,0,SEEK_END); last=ftell(fp); n=last/sizeof(struct student); fclose(fp); return n; } void listStudent() { FILE *fp; int n,i; struct student x; fp=fopen("student.dat","rb");//open file in binary mode n=countStudent(); for(i=0;i<=n-1;i++) { fread(&x,sizeof(x),1,fp); printStudent(x); } fclose(fp); } struct student searchStudent(char *scno) { FILE *fp; int n,i; struct stude...
strucstu.h file of student management system
- Get link
- X
- Other Apps
By lakahman malviya
lakshmankablog
#include<stdio.h> #include<conio.h> #include<string.h> struct mydate{ int d,m,y; }; struct student{ char name[80]; char scno[80]; int mark; int age; struct mydate dob; }; struct student readStudent(){ struct student x; fflush(stdin); printf("Enter Name:");gets(x.name); printf("Enter scno:");gets(x.scno); printf("Enter mark:");scanf("%d",&x.mark); printf("Enter age:");scanf("%d",&x.age); printf("Enter DoB:");scanf("%d%d%d",&x.dob.d,&x.dob.m,&x.dob.y); return x; } struct student updateStudent(struct student x){ fflush(stdin); int c; //update name printf("\nCurrent Name = %s",x.name); printf("\nDo you want to change name(y/n)");c=getchar(); fflush(stdin); if(...
STUDENTMANAGEMENT.CPP
- Get link
- X
- Other Apps
By lakahman malviya
lakshmankablog
#include<studstru.h> #include"projstud.h" #include <process.h> #include<stdlib.h> void TimePassGame(){ one: srand (time (0)); int rannum = rand () % 100 + 1; int myn; textcolor(RED); textbackground(WHITE); cprintf("\nEnter the number Between 1-100 "); cscanf("%d",&myn); for(int attemp=1; myn!=rannum; attemp++){ if(myn>rannum){ cprintf("\nPlease enter lower number"); cscanf("%d",&myn); } else if(myn<rannum){ cprintf("\nPlease enter Greater number "); cscanf("%d",&myn); } } cprintf("\n You Won The Game In %d Attempts",attemp); cprintf("\nHave A Nice Day.."); cprintf("\n You want to Play Again\tY/N"); char ans = getch(); if(ans=='y'||ans=='Y'){ goto one; } else{ cprintf("\nAre You Sure Wanna Exit\t Y/N"); char n= getch()...
Taking input from the user in java
- Get link
- X
- Other Apps
By lakahman malviya
lakshmankablog
package mypro; import java.util.Scanner; //public class MyOwn{ // // static void lakshman1() { // System.out.println("I just got executed!"); // } //} public class TakingInputFromTheUser { static void lakshman() { System.out.println("I just got executed!"); } public static void main(String[] args) { Scanner obj = new Scanner(System.in); System.out.println("Enter the value of a : "); String a = obj.nextLine(); System.out.println("Enter the value of b : "); int b = obj.nextInt(); System.out.println("The sum of a and b is : "+(a+b)); lakshman(); } }
Checking that given number is automorphic or not by lakshmankablog
- Get link
- X
- Other Apps
By lakahman malviya
lakshmankablog
package mypro; import java.util.Scanner; public class AutoMorphicNumber { public static void main(String[] args) { Scanner obj= new Scanner(System.in); System.out.println("Enter the number for checking is an automorphic or not "); int n= obj.nextInt(); int n2,len=0,len2,rem,rem1,rev; int restn=n; n2= n*n; while(n>0) { len++; n = n/10; } // System.out.println(len); len2=len; rev=0; for(int i= 0; i<len; i++) { rem = n2 % 10; rev= rev*10+rem; n2 = n2/10; } // System.out.println(rev); int revofrev = 0; for(int j=0; j<len2; j++) { rem1= rev%10; revofrev = revofrev*10+rem1; rev = rev/10; } // System.out.println(revofrev); if(restn==revofrev) { System.out.println("The number "+restn+" "+" is automorphic "); } else { System.out.println("The number is not automorphic "); } } }