C++这个程序哪里错了?

来源:百度知道 编辑:UC知道 时间:2024/06/14 18:08:20
#include<iostream>
using namespace std;
int main()
{
//1. 否定联结词
bool sunny;
sunny=true ;
bool weather;
weather=!sunny;
cout<<"今天的天气: "<<weather<<endl;
//2. 合取联结词
bool todayWeather;
bool tomorrowWeathr;
todayWeather=true;
tomorrowWeathr=false;
bool CanWash;
CanWash=todayWeather&&tomorrowWeather;
cout<<"今天是否能洗被子:"<<CanWash;
//3.析取联结词
todayWeather=true;
tomorrowWeather=false;
boolCanPlayFootball;
CanPlayFootball=todayWeather&&tomorrowWeather;

cout<<"周末是否能踢球:"<<CanPlayFootball;
cin.get();
return 0;
}

正确见下:
#include<iostream>
using namespace std;
int main()
{
//1. 否定联结词
bool sunny;
sunny=true ;
bool weather;
weather=!sunny;
cout<<"今天的天气: "<<weather<<endl;
//2. 合取联结词
bool todayWeather;
bool tomorrowWeather; //改为tomorrowWeather
todayWeather=true;
tomorrowWeather=false; //改为tomorrowWeather
bool CanWash;
CanWash=todayWeather&&tomorrowWeather;
cout<<"今天是否能洗被子:"<<CanWash;
//3.析取联结词
todayWeather=true;
tomorrowWeather=false;
bool CanPlayFootball; //bool与CanPlayFootball之间丢了空格
CanPlayFootball=todayWeather&&tomorrowWeather;

cout<<"周末是否能踢球:"<<CanPlayFootball;
cin.get();
return 0;
}

有两点错误:
1、tomorrowWeathr的拼写有误!应该改为tomorrowWeather
2、bool与CanPlayFootball之间丢了空格,拼写时要细心

#include<iostream>
using namespace std;
in