June 22nd, 2013, 07:46 AM
-
C++ washing machine
design a digitally controlled washing machine that sets the wash temperature to 80degree celcius for cotten clothes 40degree celcius per quick wash and 1000 revolution for rinse and dry only using MV STUDIO 2010 c++ programming
i need an improvement on this please!
#include <iostream>
using name space std;
void main()
{
int tempsensor; //from the temperature sensor console
int revolcycle; //gotten from the motor console
char washtype;
int revolution = revolcycle/timer
{
if (washtype = cotton)
{
tempsensor = 80;
cout <<"ready for cotton";
}
if (washtype = quickwash)
{
tempsensor = 40;
cout<<" ready for quickwash";
}
void rinse (int revolution)
{
return 1000;
}
void dry (int revolution)
return 1000;
}
}
June 22nd, 2013, 08:45 AM
-
Do you have a specific problem or question?
I suggest you start by fixing your compile errors. If you have questions about those errors, post the complete error messages and ask specific questions.
Also please use code tags when posting code.
Jim
June 22nd, 2013, 09:39 AM
-
hi jim
this is all i could do, please help add more in respect to the question
#include <iostream>
using namespace std;
int main()
{
int tempsensor; //from the temperature sensor console
int revolcycle=1000; //gotten from the motor console
int timer =1 ;
char washtype;
int revolution = revolcycle/timer;
char cotton;
char quickwash;
if (washtype = cotton) //link to a button in the machine through console
{
tempsensor = 80;
cout <<"ready for cotton";
return (0);
}
if (washtype = quickwash)
{
tempsensor = 40;
cout<<"ready for quick wash\n";
}
if (revolution = 1000)
{
char rinse;
char dry;
}
{
system ("pause");
}
}
June 22nd, 2013, 11:12 AM
-
1. Use [code][/code] tags when you post code, so that formatting and indentation are preserved.
Like so.
Code:
#include <iostream>
using namespace std;
int main()
{
int tempsensor; //from the temperature sensor console
int revolcycle = 1000; //gotten from the motor console
int timer = 1;
char washtype;
int revolution = revolcycle / timer;
char cotton;
char quickwash;
if (washtype = cotton) //link to a button in the machine through console
{
tempsensor = 80;
cout << "ready for cotton";
return (0);
}
if (washtype = quickwash) {
tempsensor = 40;
cout << "ready for quick wash\n";
}
if (revolution = 1000) {
char rinse;
char dry;
}
{
system("pause");
}
}
2. If you don't have GCC, then I suggest you get it (try an IDE like code::blocks which comes pre-packaged with GCC).
Then you get some rather useful error messages.
Code:
$ g++ -W -Wall -Wextra bar.cpp
bar.cpp: In function ‘int main()’:
bar.cpp:13:24: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
bar.cpp:19:27: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
bar.cpp:23:24: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
bar.cpp:24:10: warning: unused variable ‘rinse’ [-Wunused-variable]
bar.cpp:25:10: warning: unused variable ‘dry’ [-Wunused-variable]
bar.cpp:28:19: error: ‘system’ was not declared in this scope
One thing you need to understand is the difference between = and ==
= is assignment
== is comparison
Let's say
Code:
char cotton = 'C';
char quickwash = 'Q';
if (washtype == cotton) //link to a button in the machine through console
June 22nd, 2013, 12:35 PM
-
Originally Posted by alaba81
this is all i could do, please help add more in respect to the question
What question?
We won't do your homework for you. We will help you with specific questions that you may have. But first you need to ask a question!