CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 2734|Reply: 7

C++... pls help T^T

[Copy link]
Post time 8-10-2011 12:03 PM | Show all posts |Read mode
I'm juz a newbie in C++... there are still many question mark in my head... gosh!!!! Nid help from u guys....

Recently, i gt some kind of question sounds calculates the average score for students in a particular class based on user input. The program will require input results of 10 students..... The question want me to declare and initialize a symbolic constant for 10 student.... How can i do it????... help pls.... TTv
Reply

Use magic Report


ADVERTISEMENT


Post time 8-10-2011 01:08 PM | Show all posts
what means symbolic constant?

the question sound is street to the point but symbolic constant make me sense.never heard this term b4.
Reply

Use magic Report

 Author| Post time 9-10-2011 02:24 PM | Show all posts
Actually i'm still wondering what actually is the symbolic constant..... gosh!!! Thats why i;m stuck.... argh... forget it... TTv
Reply

Use magic Report

Post time 18-10-2011 07:57 PM | Show all posts
Reply 3# joyeric

A symbolic constant is a constant that is represented by a name, just as a variable is represented. Unlike a variable, however, after a constant is initialized, its value can't be changed.
There are two ways to declare a symbolic constant in C++. The old, traditional,and now obsolete way is with a preprocessor directive, #define. DefiningConstants with #define To define a constant the traditional way, you would enterthis:#define studentsPerClass 15

Reply

Use magic Report

Post time 18-10-2011 08:24 PM | Show all posts
Reply 3# joyeric

here my coding.

  1. #include <iostream>
  2. #define paria 10

  3. using namespace std;

  4. void paria2 ( double pariah) { cout<<"\nAverage student mark is : "<<pariah/paria<<endl;}

  5. void main() {

  6.         double marks, koling=0;

  7.         for (int a=0;a<paria;a++)
  8.         {
  9.                 cout<<"Key in student "<<a+1<<" marks : ";
  10.                 cin>>marks;

  11.                 koling+=marks;
  12.         }
  13.         
  14.         paria2 ( koling );
  15. }
Copy the Code
Reply

Use magic Report

Post time 1-4-2012 10:20 PM | Show all posts
Reply 5# otai_g


    apa ke paria pulak perginye?
Reply

Use magic Report

Follow Us
Post time 1-4-2012 11:10 PM | Show all posts
Reply 6# abundek

heh motif up thread lama?

btw time buat coding tu kepala aku terpikir yg perangai tt mcm yg tersebut, so terus aku guna variable tuh..
Reply

Use magic Report

Post time 2-4-2012 12:31 AM | Show all posts
Reply 7# otai_g

kelemahan aku kot, suka tengok tajuk topik "please help please!"
Reply

Use magic Report


ADVERTISEMENT


You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

3-1-2025 01:32 AM GMT+8 , Processed in 0.119214 second(s), 22 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list