BTC USD 85,579.0 Gold USD 4,121.55
Time now: Jun 1, 12:00 AM

Mencari geng2 Cg yang mahir C programming

Rileks bro, aku ni dah nak masuk umur 40an dan tak pandai IT dan part time student pulok.

// from the keyboard and then calculates and outputs* the average score
// as well as the highest and lowest score. There will be a maximum of 100 scores.
*
*
#include <iostream>
using namespace std;
*
*
*
float findAverage (int [], int);* // finds average of all grades
int** findHighest (int [], int&);* // finds highest of all grades
int** findLowest* (int [], int&);* // finds lowest of all grades
*
int main()
*
{
****const int SIZE=100;
****int* grades[SIZE];* // the array holding the grades.
****int* numberOfGrades; // the number of grades read.
****int pos; // index to the array.....LIKE COUNT
****int size;
****float avgOfGrades;// contains the average of the grades.
****int highestGrade;// contains the highest grade.
****int lowestGrade;// contains the lowest grade.
*
****// Read the values into the array
****pos = 0;
****cout << "Please input a grade from 1 to 100, (or -99 to stop)" << endl;
****cin* >> grades[pos];
*****
****//findAverage ([], size);
*
****while (grades[pos] != -99)
****{
*
********// Fill in the code to read the grades: 4 scores
********cout << "enter test score number " << (pos + 1) << ":";
********cin >> grades[pos];
******
*
****numberOfGrades = grades[pos];* // Fill blank with appropriate identifier
*
****// call to the function to find average
****avgOfGrades = findAverage(grades, numberOfGrades);
****cout << endl << "The average of all the grades is " << avgOfGrades << endl;
*
****//* Fill in the call to the function that calculates highest grade
*****
****highestGrade = findHighest(grades, size);
****cout << endl << "The highest grade is " << highestGrade << endl;
*
****// Fill in the call to the function that calculates lowest grade
*
****lowestGrade = findLowest(grades, size);
****// Fill in code to write the lowest to the screen
****cout << endl << "The highest grade is " << lowestGrade << endl;
*
****return 0;
**
*
//****************************************************************************
//******************************** findAverage
//
// task:********* This function receives an array of integers and its size.
//*************** It finds and returns the average of the numbers in the array
// data in:****** array of floating point numbers
// data returned: avarage of the numbers in the array
//
//****************************************************************************
*
float findAverage (int array[], int size)
{*
****float sum = 0;** // holds the sum of all the numbers
*
****for (int pos = 0; pos < size; pos++)
********sum = sum + array[pos];
*
****return (sum / size);* //returns the average
***********
**
*
//****************************************************************************
//******************************** findHighest
//
// task:********* This function receives an array of integers and its size.
//*************** It finds and returns the highest value of the numbers in
//*************** the array
// data in:****** array of floating point numbers
// data returned: highest value of the numbers in the array
//
//****************************************************************************
*
int** findHighest (int array[], int& size)
{
***// Fill in the code for this function
****const int SIZE=100;
****int highest;
****int grades[SIZE];
****highest = grades[0];
****for (int pos = 1; pos < SIZE; pos++)
****{
*******if (grades[pos] > highest)
**********highest = grades[pos];
******
****return highest;
**
*
*
//****************************************************************************
//******************************** findLowest
//
// task:********* This function receives an array of integers and its size.
//*************** It finds and returns the lowest value of the numbers in
//*************** the array
// data in:****** array of floating point numbers
// data returned: lowest value of the numbers in the array
//
//****************************************************************************
*
int** findLowest(int array[], int& size)
{
***// Fill in the code for this function
****const int SIZE=100;
****int lowest;
****int grades[SIZE];
****lowest = grades[0];
****for (int pos = 1; pos < SIZE; pos++)
****{
*******if (grades[pos] < lowest)
**********lowest = grades[pos];
******
****return lowest;
*
* ini coding untuk exam scores :)
 
No problem aku tak terasa pun dan mungkin ada yang sudi tolong dan boleh terangkan dkt aku dengan lebih jelas mengenai tugasan ni..aku appreciate pandangan korang..
 
Ini coding C++, bukan C.

// from the keyboard and then calculates and outputs* the average score
// as well as the highest and lowest score. There will be a maximum of 100 scores.
*
*
#include <iostream>
using namespace std;
*
*
*
float findAverage (int [], int);* // finds average of all grades
int** findHighest (int [], int&);* // finds highest of all grades
int** findLowest* (int [], int&);* // finds lowest of all grades
*
int main()
*
{
****const int SIZE=100;
****int* grades[SIZE];* // the array holding the grades.
****int* numberOfGrades; // the number of grades read.
****int pos; // index to the array.....LIKE COUNT
****int size;
****float avgOfGrades;// contains the average of the grades.
****int highestGrade;// contains the highest grade.
****int lowestGrade;// contains the lowest grade.
*
****// Read the values into the array
****pos = 0;
****cout << "Please input a grade from 1 to 100, (or -99 to stop)" << endl;
****cin* >> grades[pos];
*****
****//findAverage ([], size);
*
****while (grades[pos] != -99)
****{
*
********// Fill in the code to read the grades: 4 scores
********cout << "enter test score number " << (pos + 1) << ":";
********cin >> grades[pos];
******
*
****numberOfGrades = grades[pos];* // Fill blank with appropriate identifier
*
****// call to the function to find average
****avgOfGrades = findAverage(grades, numberOfGrades);
****cout << endl << "The average of all the grades is " << avgOfGrades << endl;
*
****//* Fill in the call to the function that calculates highest grade
*****
****highestGrade = findHighest(grades, size);
****cout << endl << "The highest grade is " << highestGrade << endl;
*
****// Fill in the call to the function that calculates lowest grade
*
****lowestGrade = findLowest(grades, size);
****// Fill in code to write the lowest to the screen
****cout << endl << "The highest grade is " << lowestGrade << endl;
*
****return 0;
**
*
//****************************************************************************
//******************************** findAverage
//
// task:********* This function receives an array of integers and its size.
//*************** It finds and returns the average of the numbers in the array
// data in:****** array of floating point numbers
// data returned: avarage of the numbers in the array
//
//****************************************************************************
*
float findAverage (int array[], int size)
{*
****float sum = 0;** // holds the sum of all the numbers
*
****for (int pos = 0; pos < size; pos++)
********sum = sum + array[pos];
*
****return (sum / size);* //returns the average
***********
**
*
//****************************************************************************
//******************************** findHighest
//
// task:********* This function receives an array of integers and its size.
//*************** It finds and returns the highest value of the numbers in
//*************** the array
// data in:****** array of floating point numbers
// data returned: highest value of the numbers in the array
//
//****************************************************************************
*
int** findHighest (int array[], int& size)
{
***// Fill in the code for this function
****const int SIZE=100;
****int highest;
****int grades[SIZE];
****highest = grades[0];
****for (int pos = 1; pos < SIZE; pos++)
****{
*******if (grades[pos] > highest)
**********highest = grades[pos];
******
****return highest;
**
*
*
//****************************************************************************
//******************************** findLowest
//
// task:********* This function receives an array of integers and its size.
//*************** It finds and returns the lowest value of the numbers in
//*************** the array
// data in:****** array of floating point numbers
// data returned: lowest value of the numbers in the array
//
//****************************************************************************
*
int** findLowest(int array[], int& size)
{
***// Fill in the code for this function
****const int SIZE=100;
****int lowest;
****int grades[SIZE];
****lowest = grades[0];
****for (int pos = 1; pos < SIZE; pos++)
****{
*******if (grades[pos] < lowest)
**********lowest = grades[pos];
******
****return lowest;
*
* ini coding untuk exam scores :)
 
Ini coding C++, bukan C.

jenuh nak translate ke C, bahasa Jawa kena convert pi bahasa Urdu...apa2 pun aku salute kat bro yg kasi code untuk bantu TT ni...RESPECT!

TT, aku cari buku yg cakap tu, actually soklan tu kat page 246 laa...
attachment.php


nko cuba draft jawapan setakat mana yg nko dah buat nanti biar otai2 kat sini tlg check...:)cgrock

ni contoh yg nko boleh refer :
http://cboard.cprogramming.com/c-programming/117383-c-program-using-structs-calculate-grades.html
http://www.cplusplus.com/forum/general/33130/

tempat study :
http://www.daniweb.com/software-development/c/118
http://cboard.cprogramming.com/c-programming/

* try google aku jumpa banyak C program untuk soklan yg TT tanya ni
 
Last edited:
Dah lama x bermain dgn C. Tt... Nanti aku tlg mana yg termampu. Senang je ni.
 
#include<stdio.h>
#include<string.h>

int mark, id_grade;
char name[31], grade[5];

main()
{
printf("Please Enter Your Name : ");
scanf("%s", &name);

printf("\nPlease Enter your mark (%): ");
scanf("%d", &mark);

if(mark<50)id_grade=1; //strcpy(grade,"FAIL");
if(mark>=50)id_grade=2; //strcpy(grade,"PASS");

switch(id_grade){

case (1):strcpy(grade,"FAIL");
break;
case (2):strcpy(grade,"PASS");
break;

default: /* catch all other characters */
printf( "Incorrect letter grade entered." );
printf( " Enter a new grade.\n" );
break; /* optional; will exit switch anyway */

**
printf("\n Ms/Mr %s, Your Grade is %s \n", name, grade);

system("pause");
**
 
lebih kurang mcm ni...tapi tak reti nak masuk nama ada 14 orang dan markah ada 6 test setiap sorang.
 
#include<stdio.h>
#include<string.h>

main()
{
char name[20];
float marks;
printf("*****************\n");
printf(" SALAM 1MALAYSIA\n");
printf("*****************\n");

printf("Please Enter first student Name\n");
scanf(" %[^\n]", name);
printf("Please Enter student marks\n");
scanf( "%f", &marks );

if((marks >=95.) && (marks <=100))
{
printf("*****************\n");
printf(" your grade is A\n");
printf("*****************\n"); **

else if((marks >=90.) && (marks <=94.))
{
printf("*****************\n");
printf(" your grade is A-\n");
printf("*****************\n"); **

else if((marks >=85.) && (marks <=89.))
{
printf("*****************\n");
printf(" your grade is B+\n");
printf("*****************\n"); **


else if((marks >=80.) && (marks <=84.))
{
printf("*****************\n");
printf(" your grade is B\n");
printf("*****************\n"); **

else if((marks >=80.) && (marks <=84.))
{
printf("*****************\n");
printf(" your grade is B\n");
printf("*****************\n"); **

else if((marks >=75.) && (marks <=79.))
{
printf("*****************\n");
printf(" your grade is B-\n");
printf("*****************\n"); **

else if((marks >=70.) && (marks <=74.))
{
printf("*****************\n");
printf(" your grade is C+\n");
printf("*****************\n"); **

else if((marks >=65.) && (marks <=69.))
{
printf("*****************\n");
printf(" your grade is C\n");
printf("*****************\n"); **

else if((marks >=60.) && (marks <=64.))
{
printf("*****************\n");
printf(" your grade is C-\n");
printf("*****************\n"); **

else if(marks <=60.)
{
printf("*****************\n");
printf(" your grade is Fail\n");
printf("*****************\n"); **
system("pause");

**
 
Back
Top
Log in Register