samedi 20 novembre 2021

pls explain the compiler error in my pattern making code

#include<iostream>
using namespace std;

int main () {
int rows;
int columns;
    cout << "Pls enter the number of rows for pattern: "; 
    cin >> rows;
    cout << "Pls enter the number of columns for pattern: ";
    cin >> columns; 

    for (int i=1; i <= rows; i++) {
        for (int j=1; j <= columns; j++){
            cout << "*";
        }
            cout << endl;
    }

char yn;
    cout << "Is the program working as intended? (y/n)";
    cin >> yn;

    while (true) {
    if (yn == 'y' || yn == 'Y') {
        cout << "Thank You, for your response :)" << endl;
    }
    else if (yn == 'n' || yn == 'N') {
        cout << "We will try to improve ;)" << endl;
    }
    return 0; } 

}

At the end of this code the output tab of this terminal shows a message as:- c:/mingw/bin/…/lib/gcc/mingw32/6.3.0/…/…/…/…/mingw32/bin/ld.exe: cannot open output file pattern.exe: Permission denied collect2.exe: error: ld returned 1 exit status


terminal shows :- The term ‘./pattern’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was include d, verify that the path is correct and try again. At line:1 char:10

./pattern <<<< CategoryInfo : ObjectNotFound: (./pattern:String) , CommandNotFoundException FullyQualifiedErrorId : CommandNotFoundException


when i open this file as an applcation in .exe format (even though i saved it with a a name —> pattern.cpp), it :- it asks for number of rows and columns but no pattern is made, instead of making a pattern of ‘*’ it staright away asks if the program runs properly. :frowning:


What is wrong with my code? im a beginner who needs help.

Aucun commentaire:

Enregistrer un commentaire