C ++代码字符串帮助! [英] C++ Code String Help!

查看:119
本文介绍了C ++代码字符串帮助!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include <iostream>

int main(){
using namespace std;
int x;
string answer ;
cout<<"Welcome to Jumble!";
cout<< endl;
cout<<"We have over 1 words to unjumble!";
cout<< endl;
cout<<"Select a number. Each number represents a puzzle.";
cout<< endl; 
cout<<"After Selection, you will see a word. Type it in its unjumbled form.";
cout<< endl;
cout<< "Type a number!";
cout<< endl;
cin>> x;

if (x==1){
cout<< endl;
cout<< "Your word is: bthabtu";
cin>> answer;
if(answer==bathtub){
	cout<< endl;
	cout<< "You are correct!";
}







我是C ++的新手。我决定制作一个Jumble文字游戏来提高我的If Statement Skills。我划掉的线有一个错误。浴缸未在此范围内声明。我确信这是一个新手的错误,但我希望自己更好。出了什么问题?谢谢,Brian。




I am new to C++. I decided to make a Jumble Word Game to improve my If Statement Skills. The line I crossed out has an error. Bathtub is not declared in this scope. I am sure this is a newbie mistake, but I wish to better myself. Any ideas what went wrong? Thanks, Brian.

推荐答案

你没有在任何地方声明一些变量, bathtab 并抱怨它是没有宣布。那么使用一些理性思考呢?这甚至不是新手或不是新手。



想法?嗯......好吧,想一想,如果你没有宣布什么,它会以某种神秘的方式宣布吗?



如果你决定创建一个游戏来提高你的 if statement skills ,那么你可能想到了你的总量需要学习是非常扭曲的,否则你会尝试更大的步骤前进。我甚至不知道该建议...可能:试着看看事情的根源。



-SA
You did not declare some variable, bathtab anywhere at all and complain that it is not declared. So how about using some rational thinking? This is not even about being newbie or not.

Ideas? Hm… Well, think about it, if you did not declare something, will it appear declared in some mystical way?

And if you decide to create a game to improve your "if statement skills", probably your idea of the total volume of what you need to learn is highly distorted, otherwise you would try to move forward in bigger steps. I don't even know what to advise… probably: try to see the root cause of things.

—SA


这篇关于C ++代码字符串帮助!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆