It may seem a small thing, but it is usually better to post your updated code as a new post in the thread, instead of editing a previous post. As it is, reading through the thread it looks as thought the only people who have posted code are rezy3312, phone98 and kemort.
Perhaps this is just a misunderstanding, but I think it explains why you aren't getting more useful replies.
int main(){
int a, b, c,d,e,f,g,n;
cout<<"booking type 1: "<<endl;
cin>>a;
cout<<"Booking type 2: "<<endl;
cin>>b;
cout<<"booking type 3: "<<endl;
cin>>c;
d= a+b+c;
e=1; //dormant download
f= d+e;
g=f%3;//average use per day
switch(n) { // SAME THING BUT n THIS TIME
case 1:
if (d>=6)
{
cout<<"total number of registered accounts is : "<< d <<endl;}
break;
case 2:
if (f>=7)
{
cout<<"total number of downloads is: "<< f <<endl;}
break;
case 3:
if (g>=1)
{
cout<<"number of usage"<< f <<endl;}
break;
Line 20: You're making a decision based on n (garbage). Frankly, I don't understand why you even have the switch statement.
You have been asked multiple times to use code tags. PLEASE DO SO. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
If you're not going to make the slightest bit of effort to make your posts readable, why should we spend the slightest bit of effort helping you?
I will not respond further until you apply code tags.
1. #include <iostream>
2. #include <cmath>
3. using namespace std;
4. int main()
5. {
6. int a, b, c,d,e,f,g;
7. cout<<"booking type 1: "<<endl;
8. cin>>a;
9. cout<<"Booking type 2: "<<endl;
10. cin>>b;
11. cout<<"booking type 3: "<<endl;
12. cin>>c;
13. d= a+b+c; //number of both drivers and users
14. e=1; //dormant download
15. f= d+e; //total downloads
16. g=f%3; //average use per day
17. if (d==6)
18. {
19. cout<<"print total number of registered accounts is : "<< d <<endl;}
20. if (f==7)
21. {
22. cout<<"print total number of downloads is: "<< f <<endl;}
23. if (g==1)
24. {
25. cout<<"print usage per day: "<< g <<endl;}
26. else {
27. cout<<"Please do re-book your fare: "<<endl;}
28. return 0;
29. }
firstly, i want a better set of inputs and output that would give me the exact result of 6(number of both drivers and users),7(total downloads and 1(usage per day) respectively.
SECONDLY i need to create a flow chart for this solution
ARE THERE NO SINGLE C++ PROGRAMMER THAT CAN HELP WITH THIS SIMPLE PROBLEM YET DIFFICULT TO CODE?
I don't recommend any changes to your program bodx. You've pretty much nailed it, especially with the line numbers. Don't change the inputs, they're fine as they are. It's ready to hand in.
Here's the flow chart. INPUT -> PROCESS -> OUTPUT
I don't think your masterpiece needs anything more than that to make your assignment shine.
You might like to green tick this thread so we can all be aware of you positive experience. Many thanks for your valuable contribution.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int mark[5], i, a,b,c,d,e;
float sum=0;
cout<<"Enter marks obtained in ENGLISH :";
cin>>a;
cout<<"Enter marks obtained in PHYSICS :";
cin>>b;
cout<<"Enter marks obtained in CHEMISTRY : ";
cin>>c;
cout<<"Enter marks obtained in MATHS : ";
cin>>d;
cout<<"Enter marks obtained in COMPUTER SCIENCE : ";
cin>>e;
i=a+b+c+d+e;
for(i=0;i<500;i++)
{
cin>>mark[i];
sum=sum+mark[i];
}
cout<<" TOTAL MARKS = "<<sum<<endl;
float avg=sum/5;
float perc;
perc=(sum/500)*100;
cout<<"Average Marks = "<<avg;
cout<<"\nPercentage = "<<perc<<"%";
getch();
}