I am trying to make a program and I am failing. The idea is that the user has to enter 2 values to get a :) in response...

I am trying to make a program and I am failing. The idea is that the user has to enter 2 values to get a :) in response. They dont know there trying to get 4, but if they enter say 2 and 2 they would get a :). If they enter a 4 and 5 the computer would return a :( and the program would loop to the beginning and they have to enter values again. I am stuck on what terminology C++ allows and doesnt allow and also general syntax gets me lots of erros so if anyone could show some source that has all this information in one site thatd be great.

Other urls found in this thread:

en.cppreference.com/w/
stackoverflow.com/a/276814/2524350
twitter.com/NSFWRedditVideo

wait what? You are trying to add the two numbers that the user inputs? What is this a? Is suppose to be the total of the two numbers they enter?

valueA is the first integer and valueB is the second integer

Learn what a string is
Learn the difference between assignment and comparison is

In fact, learn C++. Why are you trying to write programs before you know the most basic of syntax?
en.cppreference.com/w/

>return :)
10/10

do this
public String smileGenerator(int a, int b){
int sum = a + b;
if (sum == 4){
return ":)";
else{
return ":(";
}

>java
lol

A smiley face

I have no idea how to use c++ but i think that 1. You have =4 where there should be == 4 to evaluate equality

And that there must be some way of ending your if statement, (does return do this?) you smileys should probably be in quotes

because the dummies book tricked me into thinking I knew stuff

whats so funny? C++ and Java syntax is almost the same. The OP just doesnt understand the logic

Maybe you should try a simpler language like lua, you have not understood the syntax rules of the language at all.

I wonder who got quints

Nah I think Im gonna shitpost on here and stack overflow until I get it. I just started last week

>return :)

You are farther from compiling anything even remotely resembling a functioning program than I think you can really comprehend at this point. Lua is your best bet if you don't want to give up.

Or this is bait, kinda hard to tell.

Literally not a single line is correct, nearly every line containing atleast two syntax errors. Not to mention you have zero grasp of flow control or loops or logic in general. Just go learn lua.

You can try but really an interpreted lang is a much better starting point and will be easier to learn. Lua is a feature sparse lang that is very easy to learn with only one way of doing anything.

How many lines should my idea take in your opinion? I just wanted to make something simple obviously

It's not Python, you need to spend a year before you can do anything useful.

1- Initialize your valueA and valueB properly.
2- Fix the syntax for your cin and cout
3- Fix the syntax for the if
4- You should not return the smiley, but print it
5- Do not give up
6- Please read the textbook again.

same as python
nobody does anything useful in python though

I do useful shit in Python all day. Much more useful than other programming languages.

But with Python a noob can likely make something useful in a week.

Should I study LUA or Digital logic?

Could be shorter, but here's a simple example. I'm not sure what resource you were using to learn C++, but if you can't do this on your own after 30 minutes tops then something is very wrong.

#include

int main()
{
int secret = 4;
int guessOne, guessTwo;
std::cout guessOne >> guessTwo;
if ((guessOne + guessTwo) == secret) std::cout

I did that and got this. And the book is C++ for dummies

Except the error says Expected unqualified-ID

Alright that was an example from earlier. I entered it how you did and got Expected unqualified-ID

are you ok? wtf do you think

int main(x=0)

is supposed to mean

is this some mildly elaborate troll?

what useful shit?

I don't know... some web application maybe, a web scraper maybe, just be creative.

What shitty compiler are you using lmao

is this some mildly elaborate troll?

Gotcha

If this is the type of thing you're getting stuck on then maybe programming isn't for you.

>useful

Change to if(value == 4)

= Is an assignment statement and can't be used to compare

Also forgot semicolons.

You also called con wrong
cin >> var1 >> var2;
You also didn't cin.get(); or give a return value.

Don't program yet you need to read more and follow guided instruction.

Did you even declare sumvalue1 and sumvalue2?

Didn't put quotes either for your string

#include
using namespace std;

enum TSmile {
HAPPY_SMILE,
SAD_SMILE
};

int main() {
const int happy_place = 4;
int nr1, nr2;
int sum;
TSmile my_smile;

cout > nr1 >> nr2;

sum = (nr1 + nr2);

my_smile = (sum == 4 ? HAPPY_SMILE : SAD_SMILE);

switch(my_smile) {
case HAPPY_SMILE:
cout

why not just
switch (sum) {
case 4:
cout

Because then there would be no joke to smile over.

Look at me! I'm Important!

Let's take it up a notch. You want to save more than one smile, don't you?

#include
#include
using namespace std;

enum TSmile {
HAPPY_SMILE,
SAD_SMILE
};

class Smile {
private:
TSmile smile;
int code;
string str_repr;
public:
Smile() {}
Smile(TSmile smile, int code, string str_repr) {
this->smile = smile;
this->code = code;
this->str_repr = str_repr;
}
int get_code() { return code; }
string get_str_repr() { return str_repr; }
};

class SmileManager {
private:
vector smiles;
public:
SmileManager() {}
bool exists_smile(const int code) {
for(unsigned int i=0; i> nr2;

sum = (nr1 + nr2);

if(sm.exists_smile(sum)) {
cout

Impressive. How long did that take? Share it?

the dummies provide a sense and nuance of intuition for you to broaden your horizons once you've grasped the concepts of programming theory and simple black box procedures and working through them.

Don't mean to be rude but I think you're over estimating how much work you actually do.

First. You assigned two numbers to one variable. Maybe it can act like a pointer and you just iterate over but for now that struck as me incorrect.

Second. You don't type anything that isn't a keyword or construct without some kind of quotation mark. Ever. Not anywhere on the developer's side anyway. Userland is full of that.

Third. Those shifty things are not french quotes. They are shifty things. They shift the info on the side of the mouth into the struct/stream found on the pointed side.

Fourth. Every value functions separately. Even later when they are in an array or in a list, you will be iterating through the list, and as a developer, may never need to know what two specific elements will be working together. At least not as far as getting it running goes.

Fifth. Learn your keywords. There aren't many and are pretty easy to use once you realize that they function over our natural language just under more scrutiny. If you know = means assign then you are going to need more keywords if you want disambiguate. If you "equal the equal" it's quite possible you are subverting assignment and thus, in a philosophical sense, are comparing. Try to do things like that with them and eventually you'll be able to tie those operators with physical events on your machine.


7. I really like how you handle a return. If it's right, reward it, let it in. If it's wrong, lock 'em out. Although if you think about it purely symbollicaly from what would be an adult perspective you could say that in calling the iterator via '[' you could be preparing for the next step in the loop. But that's borderline theory semantics and linguistics and all kinds of weirdness.

Good tips, these, btw.

this thread gave me cancer

lol ignore that part at the end. I'm blind and I didn't enlarge pic. I thought you were returning 1> and return 1[

why the heck would you desire to make such a program?

this simpleminded philosophy is why you will never see results in programming.... in otherwords you have to strive to create real projects to see real gains.

do you practice kartwheels to create backflips?

Kek'd.
But you should use std::algorithms for exists_smile and find_smile

I don't know I just let it run for a while because I was bored. Sure you can have it: #Os2g'DRzOz

those are actually asm hardcoded values so there

it is useful... It can earn you millions of dollars, it might make the life quality of billions of people better, it might promote science leaps and bounds, it might promote democracy and freedom and so on and so forth.

>get a load of this guy

Python is the best tool for many jobs, particularly smaller command-line utilities and low-load web services.
If you can't comprehend Python's advantages, you shouldn't be coding at all.

I'm pretty sure it's actually implementation defined and is usually the return value of the last called function

you could've spent 5 seconds googling
stackoverflow.com/a/276814/2524350

So do I use it because I'm smar or because it's just there and you might as well because look it's so not difficult or else you're stupid?

>is supposed to mean
It declares variable main while initialising main to 0 and setting x to 0 as well.

...

you can't instantiate there

it's still c

what's the origin of your name?