String Processing in C and Standard String library functions

Опубликовано: 29 Август 2026
на канале: Hacked Secrets
24
3

String Processing in C and Standard String library functions

Edit by : Mohamed Yusufdeen

Copyright Disclaimer: - Under section 107 of the copyright Act 1976, allowance is mad for FAIR USE for purpose such a as criticism, comment, news reporting, teaching, scholarship and research. Fair use is a use permitted by copyright statues that might otherwise be infringing. Non- Profit, educational or personal use tips the balance in favor of FAIR USE.

Note : This video is only for educational purposes only

8. Write a program to develop an applet to play multiple audio clip

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class PlaySoundApplet extends Applet
implements ActionListener
{
Button play, stop;
AudioClip audioClip;
public void init()
}
play = new Button("Play_Loop");
add(play);
play.addActionListener(this);
stop new Button("Stop_Play");
add(stop);
stop.addActionListener(this);
audioClip = getAudioClip(getCodeBase(), "sound.wav");
public void actionPerformed(ActionEvent ae)
{
Button source = (Button)ae.getSource();
if (source.getLabel() == "Play_Loop")
{
audioClip.play();
}
else if(source.getLabel() == "Stop_Play")
{
audioClip.stop();
}
}
}
/*
=applet code="PlaySoundApplet.class" width="300" height="300"=
=/applet=
*/

9. Writing and Reading Employee Information From a file

import java io. File Writer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
public class employee 2
{
public static void main(String[] args)
{
try
{
FileWriter myWriter = new FileWriter("empfile2.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Employee Number ");
String empno = br.readLine();
System.out.println("Enter Employee Name ");
String name = br.readLine();
System.out.println("You have Entered: ");
myWriter.write(empno + name);
myWriter.close();
System.out.println("Successfully wrote to the file.");
}
catch (IOException e)
{
System.out.println("An error occurred.");
e.printStackTrace();
try
{
BufferedReader in = new BufferedReader(new FileReader("empfile2.txt"));
String str;
while ((str= in.readLine()) != null)
{
System.out.println(str);
}
}
catch (IOException e) {
}
}
}

10. Write a program to retrieve student data from a Database

import java.sql.*;
public class gfg
{
public static void main(String[] args)
{
Connection con null;
PreparedStatement p = null;
ResultSet rs null;
con connection.connectDB();
try
{
String sql="select from cuslogin"; p rs con.prepareStatement(sql); p.executeQuery();
System.out.println("id\t\tname\t\temail");
while (rs.next())
{
int id rs.getInt("id");
String name=rs.getString("name");
String email =rs.getString("email"); System.out.println(id + "\t\t" + name+ "\t\t" +email);
}
}
Catch (SQLException e)
{
System.out.println(e);
}
}
}