0

This is the script of it, I can't find any issue with it, I tried a lot of things like adding a equality sign after the multiplying one, but i didn't change anything I also get a lot of blue lines in logs that say: "suggest parentheses around assignment used as truth value"

#include <iostream>

using namespace std;

int main()
{
int attackfirst;
int zycieofiary;
int tarczaofiary;
int efektywnosctypu;

    cout << "Podaj atak atakujacego: ";
    cin >> attackfirst;
    cout << "Podaj tarcze: ";
    cin >> tarczaofiary;
    cout << "Podaj zycie ofiary: ";
    cin >> zycieofiary;
    cout << "Podaj efektywnosc typu: ";
    cin >> efektywnosctypu;

    tarczaofiary=tarczaofiary/2;
    attackfirst=attackfirst-tarczaofiary;

    if(efektywnosctypu=1) {
        attackfirst=0;}

    if(efektywnosctypu=2) {
        attackfirst=attackfirst*=0.75;}

    if(efektywnosctypu=3) {
        attackfirst=attackfirst;}

    if(efektywnosctypu=4) {
        attackfirst=attackfirst*=1.25;}

    if(efektywnosctypu=5) {
        attackfirst=attackfirst*=1.5;}


    zycieofiary=zycieofiary-attackfirst;

    cout << "Zycie ofiary to: ";
    cout << zycieofiary;


    return 0;
}
  • Welcome to Stack Overflow. Please read [the help pages](http://stackoverflow.com/help), take the SO [tour], read [ask], as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). Lastly please learn how to **[edit]** your questions to improve the, like telling us the actual errors you get when building (copy-pasted in full and complete and as text). – Some programmer dude Oct 30 '21 at 17:20
  • 3
    I also recommend you take some time to study the difference between the `=` and `==` operators. One does what you want, and the other does not. – Some programmer dude Oct 30 '21 at 17:20
  • *"I also get a lot of blue lines in logs that say: 'suggest parentheses around assignment used as truth value'"* -- isn't it nice that your compiler tries to alert you to your mistakes? Pay attention to warnings. Look at the code to which this applies (which should be the conditionals of your `if` statements). Your compiler says it is assignment. Did you intend for it to be assignment? – JaMiT Oct 30 '21 at 18:49
  • Searching for error messages is a useful trick. For example, when I searched this site for `[c++] "suggest parentheses around assignment used as truth value"` the first hit was [suggest parentheses around assignment used as truth value](https://stackoverflow.com/questions/35138605/). (The square brackets limit the search to a tag, and the quotes cause the search to look for the full phrase as-is.) – JaMiT Oct 30 '21 at 18:54

1 Answers1

0
    if(efektywnosctypu=1) {
        attackfirst=0;}

    if(efektywnosctypu=2) {
        attackfirst=attackfirst*=0.75;}

    if(efektywnosctypu=3) {
        attackfirst=attackfirst;}

    if(efektywnosctypu=4) {
        attackfirst=attackfirst*=1.25;}

    if(efektywnosctypu=5) {
        attackfirst=attackfirst*=1.5;}

I'm quite sure the "="s in the if statements are supposed to be "=="s. In most languages "=" is only used for assignment. And also, the "*="s should be "*"s since you aren't trying to assign a value, you are trying to multiply. :)