WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Sorry for the downvote. I'll get it cleaned up. It was the double post that threw me.

The solution you came up with is far superior to the suggestion.

*EDIT*
Just a final little question to be clear, after I use '>>' to grab the FIRST_NAME and LAST_NAME from the input file, does the '.get' start getting input characters after LAST_NAME has been grabbed? This has always puzzled me, whether '.get' keeps count of its position with relation to previous uses of '>>'. It would seem to make sense that it does, since the characters from FIRST_NAME and LAST_NAME would mess stuff up, but I would like to make sure of this.

Output the value from the .get and see what you have. If you ever have a question like this, your best and fastest solution is test it yourself with a small test program.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

It depends on how you've defined the OP Codes and the mnemonics.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]Do [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, they are a …
TrustyTony commented: Not so bad (but needed to run the code jpg file etc they should attach) +13
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]Do [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, they are a …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Run your loop by hand at your desk with pencil and paper.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Thank you for your quick reply, WaltP . I was doing a bit of research on arrays but im not sure how you mean for me to incorporate this into the program..

char *question[] = {"Question #1",
                    "Query #2",
                    "Pregunta #3",
                      ...
                   };

Is it just to change rand() to srand ?

No. Look it up.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I need to write a quiz program that generates random questions.
My group and I determined that we would probably need to make use of the random function, so we did our research and were able to write the following program

#include<stdio.h>
#include<stdlib.h>
int main()
{
int i;
int j[10];

for(i=0;i<10;i++)
{
j[i]=rand()%10;
printf("%d \n",j[i]);
}
}

However, 2 problems were encountered.
We were unable to come up with a way to actually link that random number with a question so as to generate random questions

Make your questions an array of questions. Then the random number can be the index of the question in question (sorry about that :))

& we noticed that each time the program was run, it generated the same "random" numbers.
Is there some parameter we'd missed ?

Yes, you missed the srand() function.


Also, learn now to format your code. You will need this as your programs get more complicated.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
#include<conio.h>  // You don't need this old non-standard header
void main()        // main is an INT function -- always has been
getch();           // What's wrong with the completely standard getchar()?
}

So, what i have done is while scanning the file i check for the occurance of '<',then i move the file pointer by 1 position.

Why? Skipping 1 character using fseek() is so much more confusing that reading a character.

Then i store the value in d variable, if it is equal to 'o' then i again move my file pointer ...

And again, why?

Is there something wrong with
1) reading an entire line
2) looking for <loc>
3) if found, look for </loc>
4) write everything between

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I know TC3 and TC4 came with very good manuals. Look up the commands in question to see what you are doing wrong.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Move the cursor with gotoxy() . Just because you output text at a certain location doesn't mean the cursor was moved.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You should be talking to a lawyer. We aren't qualified for legal advice.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Good.

By the way, you can make these IFs simpler:

if(90 <= avg)
letter = 'A';
else if(80 <= avg && avg < 90)  // for this if is it even possible for AVG 
                                // to be >= 90?
letter = 'B';
else if(70 <= avg && avg < 80)  // Same here with 80...
letter = 'C';
else if(60 <= avg && avg < 70)
letter = 'D';
else
letter = 'F';

Also if(90 <= avg) is confusing to most professionals. if(avg > 90) is the (unwritten) standard format. But this is not set in stone.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Obviously. But why?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Sorry, I am having trouble understanding what you are trying to say. Do you suggest that I insert

cout << avg << endl;

after the for loop? Or are you saying that there is a mistake within the for loop?

Really? OK:

Print out just that piece of code -- the loop.
Sit at your desk.
Put that pice of code in front of you.
Pick up a pencil.
Write down some numbers labeled FILE that will be the values of the 'file' you are going to read (based on your assignment). Use only 3 students for this.
Looking at those numbers, what should the answer be for the class average (based on your assignment). Write it down.
You can also calculate each student's average. Write them down, too.

Now, start with the FOR statement and write down num = whatever num is (from 'file' -- it's 3) grade = 0 since that's what the FOR does
Go to the next line and "input" (write down) a value for score1[grade] (the first number from your 'file')
Continue to the next statement and do what it says.
Keep doing this until you have finished the loop.

What's the value of avg? If avg is correct, you didn't follow your loop as written. If avg is wrong, why? If you don't know, do it again and really look at what you are doing.


As for "And please learn …

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Swap.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]Do [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, they are a …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

but what is wrong with my code???

Don't know what to look for. We have no idea why you think the code is wrong. You didn't explain it to us.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Not a clue what you are asking. Examples may make it clear.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And your question is?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Wait, guys, I'm confused. Is this appropriate for a C forum although I use C language in my code? Because I'm using a C++ Compiler, my assumption is to post it here in C Forum.
Well it's okay if someone moves this thread in C++ area.
I'm just currently a newbie in such forums.

C++ compilers build C programs. Be confused no longer, grasshopper.

Please explain why you are using the following headers:

#include<dos.h>
#include<iostream.h>

And what is the purpose behind:

#define g gotoxy
#define p printf
#define s scanf
#define fp fprintf
#define fs fscanf

Unless there some reason I don't fathom behind this, all that these defines do is confuse the reader.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Ahhh, we see. You are not a serious student of programming. You are just a hobbyist and don't really need to learn and understand the proper terminology. You only want to program for fun. That's fine. Just keep in mind many of us are professionals, and most are striving to be professionals, so if we correct you, it's not you. It's just our need to be accurate.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Take this piece of code:

for(grade=0; grade<num; grade++)
    {
    inp1>>score1[grade];
    inp2>>score2[grade];
    inp3>>score3[grade];
    avg=(score1[grade]+score2[grade]+score3[grade])/3;
}
cout<<avg<<endl;

Run it by hand on paper for 3 students. What does avg display?

Be sure you execute each statement exactly as written, not as you think it should be.

And please learn now to format your code properly. It helps us help you, and you yourself can see what's happening easier.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

See don't get angry buddy.If you know then just reply,otherwise leave it!Be cool dude.Moreover I don't think this problem needs to be solved by professional.I can solve it myself.Still to know innovative ideas I posted this thread.

Actually, all you posted is a description of the problem. Then, using the phrase

Please help me in full coding of the above mentioned customization

simply means "give me the working code for this problem".

bluehangook629 wasn't angry. All he said was "we won't do it for you as requested. If you need it written for you, hire someone." A perfectly valid and reasonable post.


And look at your other thread. You asked the exact same thing:

Could you provide me the code for handling the splitting operations.

Give me the code. Do my work for me. That's the message.

If you didn't mean that, think about how you ask for aid...


Also, I don't know how they teach English in India, but in the countries that use it extensively we are taught that a SPACE always follows the end-of-sentence period. And this is an English forum.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Is there a best anything? Aren't there different bests based on use? And if you don't like my best, then what? You don't really want the best? Or is someone else's best better?

IOW, never ask for best. It depends on what you are doing and how.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

In direct response to you post verbatim: "Good luck. I hope you solve it, too."

If, on the other hand, you are asking for us to help you:
[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Why not use new? It's C++ whereas malloc() C.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Try formatting your code into a sequence of readable lines

sqlStr = sqlStr & _
        "( year_id,                 period_id,              stock_code,              _
           receivable,              revenue,                total_liabilities,       _
           shareholders_equity,     total_liabilities_to_shareholders_equity,        _
           current_liabilities,     total_current_assets,   net_attributable,        _   
           inventories,             fixed_assets,           operating_cost,          _
           net_cash_operation,      price_close,            pe,     eps,             _
           pe_relative_sector,      altman_z_score,         paid_up_capital,         _
           net_profit_or_loss,      dec_stock,              dec_debtors,             _   
           inc_creditors,           net_investments,        cash_and_equivalents,    _
           retained_profit_or_loss, ebit,       mkt_cap,    sales_to_assets,         _
           rota,       roe,         debt_to_equity,         average_shares,          _
           total_assets,            shares_outstanding,     report_period_end_month, _ 
        "
   sqlStr = sqlStr & " VALUES "
   sqlStr = sqlStr & _
        "( year_id,                 period_id,              stock_code,              _
           receivable,              revenue,                total_liabilities,       _
           shareholders_equity,     total_liabilities_to_shareholders_equity,        _
           current_liabilities,     total_current_assets,   net_attributable,        _   
           inventories,             fixed_assets,           operating_cost,          _
           net_cash_operation,      price_close,            pe,     eps,             _
           pe_relative_sector,      altman_z_score,         paid_up_capital,         _
           net_profit_or_loss,      dec_stock,              dec_debtors,             _   
           inc_creditors,           net_investments,        cash_and_equivalents,    _
           retained_profit_or_loss, ebit,       mkt_cap,    sales_to_assets,         _
           rota,       roe,         debt_to_equity,         average_shares,          _
           total_assets,            shares_outstanding,     report_period_end_month, _ 
        "
   sqlStr = sqlStr & " VALUES "
   sqlStr = sqlStr & " ('" & yearIdCom & " ',        _
                         " & periodIdCom & ",        _
                         " & stockCodeCom & ",       _
                        '" & tradeReceivable & "',   _
                        '" & revenueCom & "',        _
                        '" & TotLiability & "',      _
                        '" & shareholderEqyCom & "', _
                        '" & totLiabToSE & "',       _
                        '" & curLiability & "',      _
                        '" & currentAss & "',        _
                        '" & netAttributableCom & "',_
                        '" & inventory & "',         _
                        '" & fixedAsset & "',        _
                        '" & operatingExpenses & "', _
                        '" & operatingCashFlow & "', _
                        '" & ClosingPrice & "',      _
                        '" & priceEarningRatio & "', _
                        '" & earningPerShare & …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

So if it's solved, mark the thread solved!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You may be doing too much of the work yourself. C++ provides a lot of these printing and conversion functions.

But how will that help when he goes into the next language and these conversions are not available? :icon_wink:
It's good to know how to do it...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]Do [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, they are a …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Solve what?

[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]Do [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

//I have this running but when the user inputs a different character than the program just out puts the error //message and that its. I want it to go back and ask the user if they would like to run the program again. Any //ideas?

Yep.
1) Use CODE Tags when posting.
2) Use a loop when you get a bad character.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Second, there is no space between #include and <iostream>.

So? What's the problem you're pointing out?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

There's no way to find out what values have or have not been loaded into an array.

You have to keep track of the count of values as you load them.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

p.s. Dammit, I'm in New York for the Daniweb party and won't be able to play Skyrim until Monday. :@

So use your Ipod and play Angry Birds :icon_twisted:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Your feedback will help me make myself a better programmer

OK, here goes:

First and foremost, format your code properly. #include <conio.h> -- don't use it. It's not portable and there's nothing in there you really need #include <stdio.h> -- this is (supposedly) a C++ program. Don't use C headers #include <stdio.h> -- why twice? int main() -- where is your return statement? You should be getting a compiler warning. system("c:\\batch.bat"); -- why are you executing a batch file? system("cls"); -- clearing the screen is annoying to the user. You don't need to do it. break; halts execution so the next line cannot possibly be executed. goto IMUM; -- there is rarely ever a need for GOTO. Don't use them. And since you used it after break; , you can't get to it anyway. You should have compiler warnings about this.

And if you've been programming for 12 days, why are you writing a program that can f'up your system?

All in all, I consider this a terrible program. Sorry.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Reformat your code towards the bottom and the answer will be readily apparent.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

How do you know it's not inputting the string? Immediately after you try to input it, display it. Don't just assume something is wrong. Prove it.

And it's impossible to be "executing both if and else statements". It can't be done.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

So your fix was to get rid of the function and ignore all my other comments.

If you were me, what would you do?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Well then obviously that's not how it's done.

Now if you read my comments and think about them, you should have an "aha!" moment. total += grade * 5 / 100 is kinda correct, but you need to do part of this statement in a different place.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Oh, so much wrong, it's hard to know where to start. Let's start with this:

#include <stdio.h>
#include <string.h>

char sentence[81];
char *pointer;
int a = 0;

// Do not use global variables.  Pass the values needed into the function 
// then return the value you need via the RETURN
void find_first_vowel(void)
{
    while (sentence[a] != 'A' && sentence[a] != 'a' &&
           sentence[a] != 'E' && sentence[a] != 'e' &&
           sentence[a] != 'I' && sentence[a] != 'i' &&
           sentence[a] != 'O' && sentence[a] != 'o' &&
           sentence[a] != 'U' && sentence[a] != 'u' &&
           a < strlen(sentence))
           {
                 printf("%c", sentence[a]);
                 a = a + 1;
           }
           return;                                   
}


void main(void)
{
    int j, startword, endword; 
     printf("Welcome to the ultimate pig latin translator\n");
     printf("Please enter a phrase up to 80 characters or 'stop' to end: \n\n");
 
     // What is the value of sentence at this point in the program?
     while(strcmp(sentence, "Stop") != 0 && strcmp(sentence, "STOP") != 0 && strcmp(sentence, "stop") != 0)   
     {
             printf("\nEnter a phrase or 'stop' to end: \n");
             gets(sentence);            // gets() is a VERY DANGEROUS function.  See link below.
             printf("\nThe sentence you inputted is: \n %s \n\n", sentence);
             
             pointer = strtok(sentence, " ");
             while (pointer != NULL)
             {
                  pointer = strtok(NULL, " ");
             }
             
             find_first_vowel();
             printf("%c", pointer);

Once you get this part working, explain what the program is doing wrong so we know what to look for.

Here's the link I mentioned

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

So your idea is to

double calcBasal (double grade)
{
	
for (int x = 1; x <= 18; x++)
	{
		cout << " Enter BASAL grade #" << x << " (out of 100):";
		cin >> grade;         // read 18 numbers and keep only the last one
	}

	double total;
	total = ((grade * 5) / 100); // multiply this one grade by .05
	cout << "Basal points: " << total << endl;


	return total;
}

Don't you need to accumulate (add) all the grades read in to get a total?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]To [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, they are a …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I can get a string of words until the word "end", which is what I want, but I'm confused as to where to go next. How to I get the cusomter name?

Where is the customer name? Did you read it? Is it somewhere else?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]To [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, they are a …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

50 posts in C++ forum and you wrote if (choice == "1" || "V" || "Volume") and you expected your program to work?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Read up on the syntax for printf() . You are using it wrong.

And if this is a C++ program, why are you using printf() anyway?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

please suggest, i have no idea to start

Study Harder...

[boilerplate_help_info]

Posing requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]To [b]not[/b] ask for code. We are not a coding service. We will help you fix your …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I repeat:

4) get away from the computer
and

  1. Sit down with pencil and paper and go though your simple assignment and plan out what needs to be done. Step by step.
  2. When you get the step by step done, look at each step and break it down into smaller pieces.
  3. When you can't break it down any farther, write down 12 numbers -- this becomes your 'file' (make the numbers simple.
  4. Now, starting at the top of your steps, follow them.
  5. Do exactly what the step says to do. Do not do what you meant the step to do. If you need to do that, fix the step.
  6. When you can run through all the steps correctly and get the right answer, you are now ready to program.
  7. Convert all the steps into code.
  8. Now, run through the code line by line, just like the steps.
  9. When that works, go back to the computer and start programming.

If you want to post (b) when you get it, we can see if you're on the right track. But so far you've followed very little advice.