Jannelle345
Honorary Poster
- Joined
- Sep 9, 2018
- Posts
- 250
- Reaction
- 83
- Points
- 160
Anong ibig sabihin mo paki klaro ts para malaman namin
Di po example if click nya yung edit sa chooses then input nya yung name or id na modidy nya tapus matatapak dyan dyan ako parati naka hold di ma scan yung search name or idmatik naman po diba na kapag may nilagay kang input e pwede maedit? bakit po hiwalay pa?
ay naka .exe na pala? cmd palang kameDi po example if click nya yung edit sa chooses then input nya yung name or id na modidy nya tapus matatapak dyan dyan ako parati naka hold di ma scan yung search name or id
this is vb.net codes
convert mo nalang to C konting adjustments lang siguro yan
Alam ko na po mag save to note padthis is vb.net codes
convert mo nalang to C konting adjustments lang siguro yan
Di po example if click nya yung edit sa chooses then input nya yung name or id na modidy nya tapus matatapak dyan dyan ako parati naka hold di ma scan yung search name or id
Mukhang yan yung sulution tlga paps para saan nga pala yang strcmp kasi string tlga id na ginagamit namin ehIbig mo sabihin may kasali na ang GUI sa program mo?
Bigyan kita ng clue :
Or better yet show us your code. Mahirap manghula ng logic at algorithm na ginagamit sa code mo.
- Use strcmp function on student name.
- Use strcmp function on id if its a string.
Thanks sa clue mo paps may idea na ako sa edit yan tlga ako na bibiktima ehIbig mo sabihin may kasali na ang GUI sa program mo?
Bigyan kita ng clue :
Or better yet show us your code. Mahirap manghula ng logic at algorithm na ginagamit sa code mo.
- Use strcmp function on student name.
- Use strcmp function on id if its a string.
Mukhang yan yung sulution tlga paps para saan nga pala yang strcmp kasi string tlga id na ginagamit namin eh
Thanks paps sa delete paps paano yun?You do not have permission to view the full content of this post. Log in or register now.
Thanks paps sa delete paps paano yun?
Write mode lng yung ginagamit ko para mas simpleYan ang medyo komplikado. Kailangan mo nang mag improvise dyan. Walang standard library function para dyan.
Ang pinaka simple mong magagawa ay :
Or better yet. Refer ka na lang sa example na to kasi mahaba haba na ito.
- Load mo lahat ng records sa "students.txt" file sa memory/buffer.
- Kung pwede lahat ng add, insert at delete operations doon mo gawin sa naka load sa memory/buffer.
- Open mo ulit ang "students.txt" pero hindi na append mode (a) dapat write mode na (w) sa fopen function mo. Para i overwrite o para blank na ang file na yan.
- I lagay mo pabalik ang lahat na updated data sa students record na naka load sa memory/buffer sa "students.txt" file.
You do not have permission to view the full content of this post. Log in or register now.
Paps ito yung code ko ayaw gumana yung strcmp sa akin ehYan ang medyo komplikado. Kailangan mo nang mag improvise dyan. Walang standard library function para dyan.
Ang pinaka simple mong magagawa ay :
Or better yet. Refer ka na lang sa example na to kasi mahaba haba na ito.
- Load mo lahat ng records sa "students.txt" file sa memory/buffer.
- Kung pwede lahat ng add, insert at delete operations doon mo gawin sa naka load sa memory/buffer.
- Open mo ulit ang "students.txt" pero hindi na append mode (a) dapat write mode na (w) sa fopen function mo. Para i overwrite o para blank na ang file na yan.
- I lagay mo pabalik ang lahat na updated data sa students record na naka load sa memory/buffer sa "students.txt" file.
You do not have permission to view the full content of this post. Log in or register now.
Paps ito yung code ko ayaw gumana yung strcmp sa akin eh
void dl8()
{
struct student studBuffer[5];
char studName[15];
int foundFlag, studentIndex, i;
f = fopen("Record.txt","r");
// If f is not NULL then load all the contents to buffer
if (f != NULL)
{
printf("Opening Student File Successful...\n");
// Fill our buffer of zeroes to clear out leftover garbage data.
memset(studBuffer,0,sizeof(studBuffer) * 5);
for(i=0;i<5;i++)
{
fscanf(f,"%s%s%s%d%lf%lf%lf%lf",
studBuffer[i].id,
studBuffer[i].name,
studBuffer[i].course,
&studBuffer[i].year,
&studBuffer[i].grade[0],
&studBuffer[i].grade[1],
&studBuffer[i].grade[2],
&studBuffer[i].fgrade);
}
// Now that we all the necessary data in the buffer
// we can close the file for now.
fclose(f);
}
else
{
printf("Opening Student File Failed...");
// Exit out of the function
return;
}
// Time to find out which student record to delete.
// But first we need to ask for the name of the student
printf("Enter the name of the student to remove out of the record: \n");
scanf("%s",studName);
// Now we have a name. Time to find out if that name
// is in our student records.
// Initialize our name is found flag.
// Set to 0 to signify as false.
foundFlag = 0;
// Loop counter
i = 0;
while (foundFlag != 1 && i < 5)
{
// If function strcmp returns 0 then we found a match.
if (strcmp(studName,studBuffer[i].name) == 0)
{
// Get the array index of the matching student name.
studentIndex = i;
foundFlag = 1;
}
i++;
}
// If no match is found. Return to the caller of the this function
// or exit out of this funtion.
if (foundFlag != 1)
{
printf("No found match on students name. \n");
// Exit out of function.
return;
}
// If we reached here it means we have found a match.
// Now time to write the changes in the file.
// Open the file in write mode.
f = fopen("Record.txt","w");
// If f is not NULL then write all the contents the buffer
// into the file except for the student to be removed.
if (f != NULL)
{
for(i=0;i<5;i++)
{
// Write into the file except for the array index
// of student to removed.
if (i != studentIndex)
{
fprintf(f,"%s\n%s\n%s\n%d\n%.2lf\n%.2lf\n%.2lf\n%.2lf\n",
studBuffer[i].id,
studBuffer[i].name,
studBuffer[i].course,
studBuffer[i].year,
studBuffer[i].grade[0],
studBuffer[i].grade[1],
studBuffer[i].grade[2],
studBuffer[i].fgrade);
}
}
fclose(f);
printf("Student record deletion is successful.\n");
}
else
{
printf("Student record deletion is failed.\n");
}
}
Anong compiler ginagamit nyo?
Bakit ang daming "main();" ganito? Hindi ka dapat mag call ng "main" function. Ngayon lang ako nakakita ng ganito.
Haaays! Hindi ko alam kung saan magsisimula.
Ewan ko kung tapos ka na ba nito pero eto na at binago ko ang dl8 function mo.
At tsaka masyadong nakadepende ang code sa ibang functions mo sa fixed size na number ng student records at pag nag delete ka na mababawasan na yan at hindi na gagana ng tama yong ibang mga functions mo.
Code:void dl8() { struct student studBuffer[5]; char studName[15]; int foundFlag, studentIndex, i; f = fopen("Record.txt","r"); // If f is not NULL then load all the contents to buffer if (f != NULL) { printf("Opening Student File Successful...\n"); // Fill our buffer of zeroes to clear out leftover garbage data. memset(studBuffer,0,sizeof(studBuffer) * 5); for(i=0;i<5;i++) { fscanf(f,"%s%s%s%d%lf%lf%lf%lf", studBuffer[i].id, studBuffer[i].name, studBuffer[i].course, &studBuffer[i].year, &studBuffer[i].grade[0], &studBuffer[i].grade[1], &studBuffer[i].grade[2], &studBuffer[i].fgrade); } // Now that we all the necessary data in the buffer // we can close the file for now. fclose(f); } else { printf("Opening Student File Failed..."); // Exit out of the function return; } // Time to find out which student record to delete. // But first we need to ask for the name of the student printf("Enter the name of the student to remove out of the record: \n"); scanf("%s",studName); // Now we have a name. Time to find out if that name // is in our student records. // Initialize our name is found flag. // Set to 0 to signify as false. foundFlag = 0; // Loop counter i = 0; while (foundFlag != 1 && i < 5) { // If function strcmp returns 0 then we found a match. if (strcmp(studName,studBuffer[i].name) == 0) { // Get the array index of the matching student name. studentIndex = i; foundFlag = 1; } i++; } // If no match is found. Return to the caller of the this function // or exit out of this funtion. if (foundFlag != 1) { printf("No found match on students name. \n"); // Exit out of function. return; } // If we reached here it means we have found a match. // Now time to write the changes in the file. // Open the file in write mode. f = fopen("Record.txt","w"); // If f is not NULL then write all the contents the buffer // into the file except for the student to be removed. if (f != NULL) { for(i=0;i<5;i++) { // Write into the file except for the array index // of student to removed. if (i != studentIndex) { fprintf(f,"%s\n%s\n%s\n%d\n%.2lf\n%.2lf\n%.2lf\n%.2lf\n", studBuffer[i].id, studBuffer[i].name, studBuffer[i].course, studBuffer[i].year, studBuffer[i].grade[0], studBuffer[i].grade[1], studBuffer[i].grade[2], studBuffer[i].fgrade); } } fclose(f); printf("Student record deletion is successful.\n"); } else { printf("Student record deletion is failed.\n"); } }
Thanks d2 paps dami ko nakuha tulong at alam kuna para mag reduce ng size dahil dito
Gumamit ako ng call "main" para bumalik sa main function
#include <stdio.h>
void main()
{
int exitFlag, input;
exitFlag = 0;
// This is your main program loop.
while (exitFlag == 0)
{
// Put code here that needs to loop.
printf("Give me any int value. If the value is 69 I will quit.\n");
scanf("%d",&input);
// To get out of this loop.
// Just set exitFlag to 1.
if (input == 69)
{
exitFlag = 1;
}
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?