Help me please!!

0 Xhengis Miftari · April 1, 2015
please help me with this program
Write a C++ program for a college’s admissions office. Prompt the user for a student’s numeric high school grade point average (for example, 3.2) and an admission test score from 0 to 100. Print the message “Accept” if the student has any of the following: A grade point average of 3.0 or above and an admission test score of at least 60 A grade point average below 3.0 and an admission test score of at least 80 If the student does not meet either of the qualification criteria, print “Reject”.

Post a Reply

Replies

- page 2
Oldest  Newest  Rating
0 Xhengis Miftari · May 2, 2015
thank you very very very much for your help
if you have time to explain me with simple words.
i dont undersand only two parts you have done 
why you had declare double Area=0 so what does it mean when we do =0 and  display()
thank you
0 Franz Schmidt · May 2, 2015
No problem, this forum is made just for this reason :D

to your question:
basically there are 2 types of variables (don't mix up with data types that's something different):
- global variables
- local variables

If i use a global variable i declair it outside of the main, what means i can use it in any funtion i want.
If i use local variables i would need to declair the two variables in main, what means i would need to pass on the variables as parameters in any function i need these values.
And the "= 0" is something i got used to, because in this case it is unnecessary, but whenever you use something like:
Area += 8*10; 
or something like this you get into trouble when you didn't initialize Area to 0, because there could be any number inside Area and the addition would be something unexpectedly.

And the display function is just a peace of code, which runs when gets called, without return value. it just displays the values in your console window.
And if i would use local variables i would need to pass on the variables Area and Perimeter to this function so i can execute the values.


Hope it was understandable :D
0 Xhengis Miftari · May 2, 2015
very understandable.thank you again for your help.
i am happy that a person like you exiist
0 Xhengis Miftari · April 5, 2015
hello!! i have a simple question 
i have an applciation wich i should do a switch case 0 but with typing zero should quit the applciation so i should do
case 0:



???????????
please help me
0 Xhengis Miftari · April 10, 2015
can anyone help me with this exercise plz i have an exam tomorrow and a similiar exercise like this one will be on the exam .plz help me solve it 
0 Franz Schmidt · April 10, 2015
So here you go:

#include <iostream>
using namespace std;

float add(float num1, float num2){
return num1 + num2;
}
void print_total(int *item, float sum){
cout << endl << endl << "Products bought:" << endl;
for (int n = 0; n < 3; n++){
switch (item[n]){
case 1:
cout << "cheseburger - $4.99" << endl;
break;
case 2:
cout << "pepsi - $2.00" << endl;
break;
case 3:
cout << "chips - $0.75" << endl;
break;
}
}
cout << endl << "total: $" << sum;
}
int main(){
int product;
int item[3];
float sum = 0.0;
bool exit_flag = false;
for (int i = 0; i < 3; i++){
cout << endl <<"Choose your product: " << endl;
cout << "1. cheseburger - $4.99" << endl;
cout << "2. pepsi - $2.00" << endl;
cout << "3. chips - $0.75" << endl;
cout << "0 to quit" << endl;
cout << "subtotal: $" << sum << endl;
cout << "Your choose: ";

cin >> product;
item = product;
switch (product){
case 0:
exit_flag = true;
break;
case 1:
sum = add(sum, 4.99);
break;
case 2:
sum = add(sum, 2.0);
break;
case 3:
sum = add(sum, 0.75);
break;
}
if (exit_flag){
break;
}
}
print_total(item, sum);
return 0;
}

just ask what you don't understand or what you haven't learnd jet and i'll explain it to you.:D


EDIT: Sorry but codetags still don't work properly so here you are: http://textuploader.com/xgkt
0 Franz Schmidt · April 5, 2015
If you enter a character you cant do case 0: because 0 as a number so you need to do
case '0':
  • 1
  • 2

C++

107,042 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator