int
main(){
int
count=
0
;
float
CompanyName, tTime, tPower, tBeltTension, tDistanceMovedbythePulley, tNumberofTimesuserusesprogram, tTotalnumberoftimespulleydistancechanges, tandAbove;
cout<<
"
Enter CompanyName: "
;
cin>>CompanyName;
cout<<
"
Enter time: "
;
cin>>tTime;
cout<<
"
Enter Power: "
;
cin>>tPower;
cout<<
"
Enter BeltTension: "
;
cin>>tBeltTension;
if
(tPower>=0-200){
cout<<
"
BeltTension=80"
;
cout<<
"
tDistanceMovedbythePulley=0"
;
if
(tPower>=201-250){
cout<<
"
BeltTension=90"
;
cout<<
"
tDistancemovedbythePulley=0"
;
if
(tPower>=251-300){
cout<<
"
tBeltTension=100"
;
cout<<
"
tDistancemovedbythePulley=2"
;
if
(tPower>=301-350){
cout<<
"
tBeltTension=110"
;
cout<<
"
tDistancemovedbythePulley=2"
;
if
(tPower>=351-400){
cout<<
"
tBeltTension=120"
;
cout<<
"
tDistancemovedbythePulley=4"
;
if
(tPower>=401-450){
cout<<
"
tBeltTension=130"
;
cout<<
"
tDistancemovedbythePulley=4"
;
if
(tPower>=451-500){
cout<<
"
tBeltTension=140"
;
cout<<
"
tDistancemovedbythePulley=4"
;
if
(tPower>=501>tandAbove){
cout<<
"
tBeltTension=150"
;
cout<<
"
Too Much Torque, Disengage Clutch"
;
cout<<
"
PleaseentertheNumberofTimestheuserusestheprogram\n"
;
count<<
"
PleaseentertheTotalnumberoftimesthepulleydistancechanges\n"
;
What I have tried:
#include<stdlib.h>
#include<iostream>
#include<stdio.h>
#include<conio.h>
#include<string.h>
using
namespace
std;
int
main(){
int
count=
0
;
float
CompanyName, tTime, tPower, tBeltTension, tDistanceMovedbythePulley, tNumberofTimesuserusesprogram, tTotalnumberoftimespulleydistancechanges, tandAbove;
cout<<
"
Enter CompanyName: "
;
cin>>CompanyName;
cout<<
"
Enter time: "
;
cin>>tTime;
cout<<
"
Enter Power: "
;
cin>>tPower;
cout<<
"
Enter BeltTension: "
;
cin>>tBeltTension;
if
(tPower>=0-200){
cout<<
"
BeltTension=80"
;
cout<<
"
tDistanceMovedbythePulley=0"
;
if
(tPower>=201-250){
cout<<
"
BeltTension=90"
;
cout<<
"
tDistancemovedbythePulley=0"
;
if
(tPower>=251-300){
cout<<
"
tBeltTension=100"
;
cout<<
"
tDistancemovedbythePulley=2"
;
if
(tPower>=301-350){
cout<<
"
tBeltTension=110"
;
cout<<
"
tDistancemovedbythePulley=2"
;
if
(tPower>=351-400){
cout<<
"
tBeltTension=120"
;
cout<<
"
tDistancemovedbythePulley=4"
;
if
(tPower>=401-450){
cout<<
"
tBeltTension=130"
;
cout<<
"
tDistancemovedbythePulley=4"
;
if
(tPower>=451-500){
cout<<
"
tBeltTension=140"
;
cout<<
"
tDistancemovedbythePulley=4"
;
if
(tPower>=501>tandAbove){
cout<<
"
tBeltTension=150"
;
cout<<
"
Too Much Torque, Disengage Clutch"
;
cout<<
"
PleaseentertheNumberofTimestheuserusestheprogram\n"
;
count<<
"
PleaseentertheTotalnumberoftimesthepulleydistancechanges\n"
;
Here you are a version of your source code the compiler could digest without complains (at least
g++ 9.3.0
does it).
There remain poor coding and logic errors though (for instance, your conditions are 'all the same'). Possibly you should detail your requirements in order to get better help.
#include
<
iostream
>
using
namespace
std;
int
main()
string CompanyName, tTime;
double
tPower, tBeltTension;
cout
<
<
"
Enter CompanyName: "
;
cin
>
>
CompanyName;
cout
<
<
"
Enter time: "
;
cin
>
>
tTime;
cout
<
<
"
Enter Power: "
;
cin
>
>
tPower;
cout
<
<
"
Enter BeltTension: "
;
cin
>
>
tBeltTension;
if
(tPower
>
=
0
-
200
)
cout
<
<
"
BeltTension=80"
;
cout
<
<
"
tDistanceMovedbythePulley=0"
;
if
(tPower
>
=
201
-
250
)
cout
<
<
"
BeltTension=90"
;
cout
<
<
"
tDistancemovedbythePulley=0"
;
if
(tPower
>
=
251
-
300
)
cout
<
<
"
tBeltTension=100"
;
cout
<
<
"
tDistancemovedbythePulley=2"
;
if
(tPower
>
=
301
-
350
)
cout
<
<
"
tBeltTension=110"
;
cout
<
<
"
tDistancemovedbythePulley=2"
;
if
(tPower
>
=
351
-
400
)
cout
<
<
"
tBeltTension=120"
;
cout
<
<
"
tDistancemovedbythePulley=4"
;
if
(tPower
>
=
401
-
450
)
cout
<
<
"
tBeltTension=130"
;
cout
<
<
"
tDistancemovedbythePulley=4"
;
if
(tPower
>
=
451
-
500
)
cout
<
<
"
tBeltTension=140"
;
cout
<
<
"
tDistancemovedbythePulley=4"
;
if
(tPower
>
=
501
)
cout
<
<
"
tBeltTension=150"
;
cout
<
<
"
Too Much Torque, Disengage Clutch"
;
cout<<"PleaseentertheNumberofTimestheuserusestheprogram\n";
count<<"PleaseentertheTotalnumberoftimesthepulleydistancechanges\n";
A simple indentation should have shown you t-he problem.
Advice: Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.
#include
<
stdlib.h
>
#include
<
iostream
>
#include
<
stdio.h
>
#include
<
conio.h
>
#include
<
string.h
>
using
namespace
std;
int
main(){
int
count=
0
;
float
CompanyName, tTime, tPower, tBeltTension, tDistanceMovedbythePulley, tNumberofTimesuserusesprogram, tTotalnumberoftimespulleydistancechanges, tandAbove;
cout
<
<
"
Enter CompanyName: "
;
cin
>
>
CompanyName;
cout
<
<
"
Enter time: "
;
cin
>
>
tTime;
cout
<
<
"
Enter Power: "
;
cin
>
>
tPower;
cout
<
<
"
Enter BeltTension: "
;
cin
>
>
tBeltTension;
if
(tPower
>
=
0
-
200
){
cout
<
<
"
BeltTension=80"
;
cout
<
<
"
tDistanceMovedbythePulley=0"
;
if
(tPower
>
=
201
-
250
){
cout
<
<
"
BeltTension=90"
;
cout
<
<
"
tDistancemovedbythePulley=0"
;
if
(tPower
>
=
251
-
300
){
cout
<
<
"
tBeltTension=100"
;
cout
<
<
"
tDistancemovedbythePulley=2"
;
if
(tPower
>
=
301
-
350
){
cout
<
<
"
tBeltTension=110"
;
cout
<
<
"
tDistancemovedbythePulley=2"
;
if
(tPower
>
=
351
-
400
){
cout
<
<
"
tBeltTension=120"
;
cout
<
<
"
tDistancemovedbythePulley=4"
;
if
(tPower
>
=
401
-
450
){
cout
<
<
"
tBeltTension=130"
;
cout
<
<
"
tDistancemovedbythePulley=4"
;
if
(tPower
>
=
451
-
500
){
cout
<
<
"
tBeltTension=140"
;
cout
<
<
"
tDistancemovedbythePulley=4"
;
if
(tPower
>
=
501
>
tandAbove){
cout
<
<
"
tBeltTension=150"
;
cout
<
<
"
Too Much Torque, Disengage Clutch"
;
cout
<
<
"
PleaseentertheNumberofTimestheuserusestheprogram\n"
;
count
<
<
"
PleaseentertheTotalnumberoftimesthepulleydistancechanges\n"
;
Indentation style - Wikipedia
[
^
]
Best C++ Formatter and Beautifier
[
^
]
Online C/C++ Formatter, Indenter and Beautifier – Techie Delight
[
^
]
Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home
[
^
]
ultraedit
[
^
]
Enabling Open Innovation & Collaboration | The Eclipse Foundation
[
^
]
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad
spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it.
Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.