|
Post by AMan on Feb 11, 2005 0:26:11 GMT
I have a C++ problem. Can I post it here?
//This is to be a database test in VC++.net
#include<iostream> using namespace std;
short main(){
short i=1; int name[1]; char y; y='y';
while (y == 'y'){ cout << "EnterName Y"; //it will only ask for the cin once then it saves y //and the loop won't ask again it gets //stuck in bad logic cin >> y; if (y == 'y'){ name[i=i+1]; cout << "Enter Name"; cin >> name[i]; } }//programming ends befor this runs short a; for(a=0;a==i;a++) cout << "name[a]";
return 0;}
|
|
|
Post by Ildûrest on Feb 11, 2005 6:02:06 GMT
I really expect more from you by now Arian...
If you don't know how to do something THIS simple by now, I'm really starting to doubt whether you'll ever be a competent programmer.
I still think your best bet would be to completely drop C++ and get your thinking straight in QB. To me it's incredibly obvious where the problem lies, but if it isn't obvious to you, you must learn how to work out such problems before you do anything else.
If you really want to fix this program up, draw a flow chart of every bit of it, and send it to me.
|
|
|
Post by AMan on Feb 14, 2005 3:46:06 GMT
I can't past my flowchart
Start | Loop While you want to add names | | | | | | Ask if you want to add a name Yes Input Name no | Output Names | End
|
|
|
Post by Ildûrest on Feb 14, 2005 7:48:17 GMT
Draw it and scan it or something. Or draw it using a QB program.
|
|
fatai
New Member
whao!
Posts: 6
|
Post by fatai on Feb 15, 2005 8:06:10 GMT
:)Hi, i will love to know more about this , what is flow chart ,programming,because am trying to learn about computer programming. tell me more on the usage .
Cheers fatai
|
|
|
Post by Ildûrest on Feb 16, 2005 11:18:32 GMT
Why not.
Flowcharting is a good way to get you thinking the right way about your problem. In simple terms, there's just a lot of boxes, and each has a small step to do inside it. Then there's an arrow from each box leading to other boxes.
Here's a simple time flowchart: (Unfortunately it'll look bad because spaces get deleted here, but you should get the picture)
(Start) | <--------------------X \|/ [Wait 1 second] | \|/ [Add 1 to seconds%] | \|/ <Is seconds% > 59?>No---(Arrow to X) Yes| \|/ [seconds% = 0, Add 1 to Minutes%] | \|/ <Is minutes% > 59?>No---(Arrow to X) Yes| \|/ [minutes% = 0, Add 1 to hours%] | \|/ <Is hours% > 23?>No---(Arrow to X) Yes| \|/ [hours% = 0]---(Arrow to X)
|
|
|
Post by AMan on Feb 21, 2005 3:11:25 GMT
Flow Cherts are an outline for a program
|
|
|
Post by AMan on May 20, 2005 2:16:21 GMT
This program works when you use a short not a char to end the loop, but why?
|
|
|
Post by Ildûrest on May 20, 2005 6:14:33 GMT
Which program? Which line? :S
|
|
|
Post by GetAHead on Jun 1, 2005 6:23:39 GMT
Look up on-line bissness logic: OUTPUT Document, INPUT Document, Interial Document, Exteral Document, Herency Charts, Flow Charts, Flow Chart Syntex. This is where dissenss programming starts in "logic and disinge".
|
|
|
Post by Oh on Jun 1, 2005 6:27:08 GMT
And I don't know how that loop thing works with the Chr not I sleepy..
|
|