Skip to content

Instantly share code, notes, and snippets.

@mhassanist
mhassanist / main.dart
Last active February 10, 2019 06:59
Basic Flutter app with a button that shows Toast without using MaterialApp
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
void main() {
runApp(WidgetsApp(
builder: (context, int) {
return Container(
color: Colors.white,
child:Center(
child: RaisedButton(
@mhassanist
mhassanist / main.dart
Created February 10, 2019 08:47
Show Snackbar by clicking on a button
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
void main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
///// variable naming /////
//bad
double m1=13;
double m2=14;
double sum = m1+m2;
//kinda better
double mark1 =13;
double mark2 =14;
double sum_marks = mark1+mark2;
package com.reviapps.traveldistance.business;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
/*Goal: Practice using a class*/
#include<iostream>
using namespace std;
class Student
{
string name;
int id;
//Give this class
/*The header file for main.cpp*/
#include<iostream>
using namespace std;
class Dog
{
string name;
#include<iostream>
using namespace std;
class Dog
{
string name;
int licenseNumber;
public:
void setName(string nameIn);
/*Goal: practice creating and using classes.
**Create a class called Cat.
**Create the following members:
**private members: name, breed, age
**public members: setName, setBreed,setAge
**getName, getBreed, getAge, printInfo*/
#include<iostream>
using namespace std;
class Cat
{
string name;
string breed;
int age;
public:
void setName(string nameIn);
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <string>