Register and join over 40,000 other developers!
Recent Topics
-
Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
-
Learn algorithms and programming concepts
johnnylo - Apr 23 2019 07:49 AM
-
Job Gig PHP Form Needed
PJohnson - Apr 18 2019 03:55 AM
-
How to make code run differently depending on the platform it is running on?
xarzu - Apr 05 2019 09:17 AM
-
How do I set a breakpoint in an attached process in visual studio
xarzu - Apr 04 2019 11:47 AM
Recent Blog Entries
Recent Status Updates
Popular Tags
- networking
- Managed C++
- stream
- console
- database
- authentication
- Visual Basic 4 / 5 / 6
- session
- Connection
- asp.net
- import
- syntax
- hardware
- html5
- array
- mysql
- java
- php
- c++
- string
- C#
- html
- loop
- timer
- jquery
- ajax
- javascript
- programming
- android
- css
- assembly
- c
- form
- vb.net
- xml
- linked list
- login
- encryption
- pseudocode
- calculator
- sql
- python
- setup
- help
- game
- combobox
- binary
- hello world
- grid
- innerHTML

3 replies to this topic
#1
Posted 30 March 2012 - 01:38 PM
i got stuck
#include <iostream>
using namespace std;
int main()
{
int choice;
int Startingtime;
int Get()(
system("CLS");
cout << "--Distance Call Charge Calculator--\n";
cout << " 1. Display Distance Call Charge.\n";
cout << " 2. Calculate Distance Call charge\n";
cout << " 3. Exit.\n";
cout << " Enter your choice and press enter: ";
cin >> choice;
switch (choice)
{
case 1:
cout << "Starting time , Rates per min\n";
cout << "00.00 ----- 06.59\n";
cout << "07.00 ----- 19.00\n";
cout << "19.01 ----- 23.59\n";
system("pause");
case 2:
bool isValid = 1;
cout << "input Starting time";
if(Startingtime< 23.59) {
bool isValid = 0;
}
cout << "Error\n";
END
GET the last two digits from the startTime
SET lastDigits to the last two digits
IF lastDigits is between 0 and 59 inclusive THEN
SET isValid to True
Else display "error"
ENDIF
UNTIL isValid is True
READ numMinutes
IF startTime is between 00.00 and 06.59 inclusive THEN
SET ratesPerMin to 0.12
ELSE IF startTime is between 07.00 and 19.00 inclusive THEN
SET ratesPerMin to 0.55
ELSE IF startTime is between 19.01 and 23.59 inclusive THEN
SET ratesPerMin to 0.35
END IF
COMPUTE totalCharges as ratesPerMin times numMinutes
Display totalCharges
case 3:
exit(0);
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int choice;
int Startingtime;
int Get()(
system("CLS");
cout << "--Distance Call Charge Calculator--\n";
cout << " 1. Display Distance Call Charge.\n";
cout << " 2. Calculate Distance Call charge\n";
cout << " 3. Exit.\n";
cout << " Enter your choice and press enter: ";
cin >> choice;
switch (choice)
{
case 1:
cout << "Starting time , Rates per min\n";
cout << "00.00 ----- 06.59\n";
cout << "07.00 ----- 19.00\n";
cout << "19.01 ----- 23.59\n";
system("pause");
case 2:
bool isValid = 1;
cout << "input Starting time";
if(Startingtime< 23.59) {
bool isValid = 0;
}
cout << "Error\n";
END
GET the last two digits from the startTime
SET lastDigits to the last two digits
IF lastDigits is between 0 and 59 inclusive THEN
SET isValid to True
Else display "error"
ENDIF
UNTIL isValid is True
READ numMinutes
IF startTime is between 00.00 and 06.59 inclusive THEN
SET ratesPerMin to 0.12
ELSE IF startTime is between 07.00 and 19.00 inclusive THEN
SET ratesPerMin to 0.55
ELSE IF startTime is between 19.01 and 23.59 inclusive THEN
SET ratesPerMin to 0.35
END IF
COMPUTE totalCharges as ratesPerMin times numMinutes
Display totalCharges
case 3:
exit(0);
}
return 0;
}
#2
Posted 31 March 2012 - 02:02 AM
It's more a pseudo-code than a source code.
Well!
At the end of every case label body use the break statement to jump out of the switch else it will start execution from the point where the case matches.
Start it simple, put off all the pseudo-code and try to write that way as you know. Then post your problems and you will get help soon.
Besides, wrap your code in the code tags to make it easy for all to read and understand your code.
Hope this helps!
Well!
What are you trying to do here? If you are trying to define a function here than its not possible because you cannot define one function within another.int Get()(
At the end of every case label body use the break statement to jump out of the switch else it will start execution from the point where the case matches.
Start it simple, put off all the pseudo-code and try to write that way as you know. Then post your problems and you will get help soon.

Besides, wrap your code in the code tags to make it easy for all to read and understand your code.
Hope this helps!
I think i'm able to write a code for printing "Hello, World!". Proud of that!
#3
Posted 31 March 2012 - 02:20 AM
It's more a pseudo-code than a source code.
Well!
What are you trying to do here? If you are trying to define a function here than its not possible because you cannot define one function within another.
At the end of every case label body use the break statement to jump out of the switch else it will start execution from the point where the case matches.
Start it simple, put off all the pseudo-code and try to write that way as you know. Then post your problems and you will get help soon.
Besides, wrap your code in the code tags to make it easy for all to read and understand your code.
Hope this helps!
thank you, but could u please show me an example
#4
Posted 31 March 2012 - 10:07 AM
Example of what? Well there are certain pseudo-code conventions.
A typical C++ program would look like this:
Header files on the top,
At least on function should must be there which is the main() function,
And the main() contains program statements which might be variable declarations, some calculations or a call to another function, etc.
The switch is gonna look like this:
Well! It would be better that you start your work and if you get some problems then come with your code and ask.
Good Luck!
A typical C++ program would look like this:
Header files on the top,
#include <iostream>
At least on function should must be there which is the main() function,
int main() { }
And the main() contains program statements which might be variable declarations, some calculations or a call to another function, etc.
The switch is gonna look like this:
switch(expression) { case 1: statements-1; statements-2; statements-n; break; case 2: statements-1; statements-2; statements-n; break; default: statements; break; // Optional }
Well! It would be better that you start your work and if you get some problems then come with your code and ask.
Good Luck!
I think i'm able to write a code for printing "Hello, World!". Proud of that!
Also tagged with one or more of these keywords: pseudocode
General Forums →
General Programming →
Pseudocode BasicsStarted by Veals12, 24 Mar 2016 ![]() |
|
![]() |
||
General Forums →
General Programming →
[Homework] Loading and finding integers in an arrayStarted by Kaiser, 24 Nov 2015 ![]() |
|
![]() |
||
General Forums →
General Programming →
Writing a time calculator in PseudocodeStarted by SoloDoloPyro, 10 Sep 2015 ![]() |
|
![]() |
||
General Forums →
General Programming →
Pseudocode and flowchart helpStarted by xgen, 27 Jul 2015 ![]() |
|
![]() |
||
General Forums →
General Programming →
How to create a flowchart for this qestion.Started by BeckBeishen, 09 Jun 2015 ![]() |
|
![]() |
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download