Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8547667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:18:53+00:00 2026-06-11T13:18:53+00:00

Here is what I wrote: #include <iostream> using namespace std; struct vetura{ char ngjyra[10];

  • 0

Here is what I wrote:

#include <iostream> 
using namespace std; 

struct vetura{
    char ngjyra[10];
    char tipi[10];
};

int main(){
    int i,j;
    vetura v[4];

    for(i=0;i<4;i++){
        cout << "Ngjyra:"<<endl;
        cin >> v[i].ngjyra;
        cout << "tipi:"<<endl;
        cin >> v[i].tipi;
    }
    j=0;
    for(i=0;i<4;i++){
        if(v[i].ngjyra == "kuqe" && v[i].tipi == "passat")
        j+1;
    }
    cout<<"kemi "<<j<<" vetura passat me ngjyre te kuqe";


    cin.get();cin.get();
    return 0;
}

I need to count how many times I have wrote “kuqe” for v[i].ngjyra and “passat” for v[i].tipi together. I thought the variable j is going to get bigger everytime it counts but it is not working and I am going to have an exam in the following hours can anyone help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:18:54+00:00Added an answer on June 11, 2026 at 1:18 pm

    You have two problems:

    First:

    Change:

        j+1;
    

    to:

        j = j+1;
    

    Or simpler:

        j++;
    

    Second:

    v[i].ngjyra == "kuqe" will never be true. You are checking whether the location of v[i].ngjyra is the same as the location of "kuqe". And it isn’t.

    If you want to test whether the character strings have the same value, change:

    v[i].ngjyra == "kuqe"
    

    to:

    strcmp( v[i].ngjyra, "kuqe" ) == 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code #include<iostream> #include<fstream> using namespace std; int main() { int* arr
Here's a small test program I wrote: #include <iostream> using namespace std; class A
Problematic code: #include <array> #include <iostream> #include <cstring> int main(int argc, char *argv[]) {
Here is some code I wrote (using GCC's __restrict__ extension to C++): #include <iostream>
I wrote a simple c++ program that prints Hello World! #include <iostream> using namespace
I have tried to write this code: #include <iostream> #include <map> using namespace std;
#include <stdio.h> #include <sys/shm.h> #include <sys/stat.h> #include <string> #include <vector> #include <iostream> using namespace
i have wrote code for quicksort with linked list ,here is code #include<stdio.h> #include<iostream>
Here I wrote a C program which executes hi.sh file using system call. Here
Here is my code: //--------------------------------------------------------------------------- #pragma hdrstop #include <tchar.h> #include <string> #include <iostream> #include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.