Difference between revisions of "Conversational-AI-Tools/C2/Coding-with-AI/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 148: Line 148:
  
 
Please review it for correctness, readability, and best practices.
 
Please review it for correctness, readability, and best practices.
|| Type this promptPress Enter.  
+
|| Type this prompt. Press Enter.  
 
|-  
 
|-  
 
|| Highlight the generated response in the Chat window
 
|| Highlight the generated response in the Chat window
Line 218: Line 218:
  
 
'''Thank you'''
 
'''Thank you'''
|| This Spoken Tutorial is brought to you by EduPyramids Educational Services Private limited SINE IIT Bombay. Thank you for joining!  
+
|| This Spoken Tutorial is brought to you by '''EduPyramids Educational Services Private Limited''', '''SINE, IIT Bombay.'''
 +
 
 +
Thank you for joining!  
 
|-
 
|-
 
|}
 
|}

Latest revision as of 12:55, 24 November 2025

Title of the script: Coding with AI

Author: Sudhakar Kumar and EduPyramids Team.

Keywords: chatgpt, ai, assistant, code, review, video tutorial.

Visual Cue Narration
Slide 1

Title Slide

Welcome to the Spoken Tutorial on Coding with AI.
Slide 2

Learning Objectives

In this tutorial, we will learn how to use ChatGPT to
  • Explain programming concepts and
  • Get our code reviewed
Slide 3

System Requirements

To record this tutorial, I am using

  • Ubuntu Linux OS v22.04
  • Firefox web browser v141.0.4
  • Visual Studio Code v1.100.3
To record this tutorial, I am using the following setup.
Slide 4

Pre-requisites

To follow this tutorial, learners should have basic knowledge of:
  • Using internet, and
  • Programming in C/C++
Slide 5

Code Files

The following code files are required to practice this tutorial.

  1. strReverse.cpp
  2. abstractCls.cpp

These files are provided in the Code Files link of this tutorial page.

The following code files are required to practice this tutorial.

These files are provided in the Code Files link of this tutorial page.

Slide 6

Significance of Conversational AI

  • Tools like ChatGPT can serve as a reliable coding assistant.
  • It can help with syntax, explain tricky concepts, review your code, and suggest optimizations.
  • It is like a knowledgeable colleague you can ask anytime for guidance.
Suppose I forgot how to use typedef in C programming.

Let us go to ChatGPT and ask how to use typedef.

Go to the left Panel and Click on New Project. First, let us create a New project.
Highlight Projects on the left side of the pageClick on Projects.

Type name: C/C++ Programming

Click on Create Project button.

Projects help us organize our work better.

Projects keep chats, files, and custom instructions in one place.

Click on Projects and enter a name of your choice.

I will add the name, C/C++ Programming.

Click on Create Project.

Highlight C/C++ Programming under Projects Observe that the project is created.
Highlight the name C/C++ Programming above Ask Anything The name of the project appears above the Chat window.

It indicates that we are now in the workspace of our project.

Highlight the Chat window in the project workspace Let us now ask our queries here.
Type:

Explain how to use typedef in C programming with some examples. Press Enter.

Type,

Explain how to use typedef in C programming with some examples. Press Enter.

Highlight the generated response in the Chat window ChatGPT first explains what a typedef is, followed by its syntax and usage.
Now, suppose I have written some code.

I want ChatGPT to review it.

#include <iostream>

#include <string>

using namespace std;

int main() {

string str = "Spoken Tutorial";

string rev = "";

for (int i = str.size() - 1; i >= 0; i--) {

rev += str[i];

}

cout << "Reversed: " << rev << endl;

return 0;

}

I have written a C++ code to reverse a string.

The code works fine, but I want ChatGPT to suggest improvements.

For that, we can directly copy and paste the code in the Chat window.

Then give the prompt.

Highlight Chat under C/C++ Programming


Type: You are a C++ software engineer.

I have written a code, strReverse.cpp which reverses a string.

Please review it for correctness, readability, and best practices.

Type this prompt. Press Enter.
Highlight the generated response in the Chat window Observe that it first confirms the correctness of the program.

Next, it checks for readability, best practices, and improvements.

If needed, we can ask follow-up questions.

We can ask ChatGPT to explain some code as well.
Open abstractCls.cpp in visual studio code editor and highlight the following part

class Shape {

public:

virtual double area() const = 0;

};

I have a class-based code that uses an abstract class.

I want to understand why an abstract class is being used in this code.

Highlight abstractCls.cpp on the Desktop I have saved this program as abstractCls.cpp on my system.

Let us add this file to the project workspace.

Click on the project titled C/C++ Programming.

Click File icon and upload Click on the Add Files icon and upload abstractCls.cpp file
Type the command in the ChatGPT:

You are a C++ software engineer.

I have attached a file abstractCls.cpp which has an abstract class.

Go through the code and explain why an abstract class is needed in this code.

In the Chat window, type the following prompt.

Press Enter and observe the response.

Slide 7

Summary

In this tutorial, we have learnt how to use ChatGPT to

  • Explain programming concepts
  • Get our code reviewed
With this, we come to the end of this tutorial.

Let us summarise.

Slide 8

Assignment

As an assignment,

  • Create a new project and give the C++ code that reverses a string to ChatGPT.
  • Ask it to write an equivalent Python code.
  • Ensure that both programs produce the same results.
As an assignment, please do the following.
Slide 9

Thank you

This Spoken Tutorial is brought to you by EduPyramids Educational Services Private Limited, SINE, IIT Bombay.

Thank you for joining!

Contributors and Content Editors

Ketkinaina, Sudhakarst