“phrase de reformularité” Réponses codées

phrase de reformularité

#include <iostream>
#include <cmath>
using namespace std;


int main() {
    // Declare R. P
    double r;
    double p = 3.14; 
    
    // Read R
    cout << "Enter the Radius: ";
    cin >> radius;
    
    // Solve the Radius of a circle
    // using radius formula in circle
    radius = pi * pow(radius, 2);
    
    double circle = 2 * pi * radius;
    
    // Display R and C
    cout << "Radius of Circle = " << radius << endl;
    cout << "Circle Area = " << circle << endl;
    
    return 0;
}
Stormy Snake

phrase de reformularité

#include <iostream>
#include <string>
using namespace std;
class date {
private:
    int day;
    int month;
    int year;
};
class event {
public:
    string location;
    string names;
    event() {
        location = "Texas";
    }
private:
    string a;
};
int main() {
    event addressobj;
    cout << addressobj.location<< endl;

    return 0;
}
Annoying Antelope

phrase de reformularité

#include <iostream>
#include <cmath>
using namespace std;


int main() {
    // Declare R. P
    double r;
    double p = 3.14; 
    
    // Read R
    cout << "Enter the Radius: ";
    cin >> radius;
    
    // Solve the Radius of a circle
    // using radius formula in circle
    radius = pi * pow(radius, 2);
    
    double circle = 2 * pi * radius;
    
    // Display R and C
    cout << "Radius of Circle = " << radius << endl;
    cout << "Circle Area = " << circle << endl;
    
    return 0;
}
Stormy Snake

phrase de reformularité

import java.io.FileNotFoundException;
import java.util.Scanner;
import java.io.File;
import java.io.IOException;
  import java.io.FileWriter;
  public class TaskPerf {


      public static void register(String userName, String password) throws IOException {


          File myObj = new File("records.txt");

        if(myObj.createNewFile())
            System.out.println("File Created...");

        
        try ( 
                FileWriter file = new FileWriter(myObj, true)) {
            
            file.write(userName + " " + password + "\n");
            
        }
    }

    
    public static boolean authenticate(String userName, String password) throws FileNotFoundException {
        
        File myObj = new File("records.txt");
        Scanner myReader = new Scanner (myObj);

        
        while (myReader.hasNextLine()) {
            String data = myReader.nextLine();
            String splitData[] = data.split(" ");

            
            if (userName.equals(splitData[0]) && password.equals(splitData[1])) {
                return true;
            }
        }

        
        return false;
    }
    
    
    public static void main(String[] args)throws IOException {
        
        Scanner scan = new Scanner(System.in);
        String userName, passWord;
        
        try {
            while (true) {
		System.out.println("\n---------------------------------------");
                System.out.println("\nMenu");
                System.out.println("1. Register");
                System.out.println("2. Login");
                System.out.println("0. Exit");     
		System.out.println("\n---------------------------------------");           
                int choice = scan.nextInt();
                switch (choice) {
                    case 1 -> {
                        
                        System.out.println("Username: ");
                        userName = scan.next();

                        
                        while (!userName.matches("[a-zA-Z0-9]+")) {
                            System.out.println("Invalid Username.....Please type Alphanumeric characters");                        
                            System.out.println("Username: ");
                            userName = scan.next();
                        }
                        
                        System.out.println("Password: ");
                        passWord = scan.next();

                        
                        while (!passWord.matches("[a-zA-Z0-9]+")) {
                            System.out.print("Invalid Password.....Please type Alphanumeric characters");
                            System.out.println("Password: ");                            
                            passWord = scan.next();                            
                        }

                        System.out.println("You've succesfully registered your account!");
                        register(userName, passWord);
                    }
                    case 2 -> {
                        
                        System.out.println("Username: ");
                        userName = scan.next();
                        System.out.println("Password: ");
                        passWord = scan.next();

                        
                        if (authenticate(userName, passWord))
                            System.out.println("Successfully logged in!");
                        else
                            System.out.println("Incorrect username or password");
                    }
                    case 0 -> System.exit(0);
                    default -> System.out.println("Invalid Output");
                    


                }
            }
      
    }
    }
    

			
            
            						
Kylevincent Gutierrez

Réponses similaires à “phrase de reformularité”

Questions similaires à “phrase de reformularité”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code