This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ AlignOutPut – left justify and align a set of strings to improve the appearance of program output | |
namespace AlignOutPut | |
{ | |
using System; | |
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
string[] names = (“Christa”, “Sarah”, “Jonathan”, “Sam”, “Schmekowitz”); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Build A Sentence – the following program constructs sentences by concatenating user input until the //user enters one of the termination characters | |
//This program shows you when you need to look for string equality the | |
using System; | |
namespace BuildASentence | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
Console.WriteLine(“Each line you enter will be added to a sentence until you enter Exit or Quit”); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//C# Program = Calculate Interest Table with Functions | |
//CalculateInterestTableWithFunctions – generate an interest table much like the other interest table //programs, but this time using reasonable divison among several functions | |
Namespace CalculateInterestTableWithFunctions | |
{ | |
// Section 1 – input the data you will need to create the table | |
decimal mPrincpal = 0; | |
decimal mInterest = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Test | |
//Object parameter always refers to a database item | |
{ | |
public static void Main() | |
{ | |
checkImage(object newspic) | |
object | |
string | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Test | |
//Object parameter always refers to a database item | |
//newspic is a database column | |
{ | |
public static void Main() | |
{ | |
checkImage(object newspic) | |
object | |
string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Default Arguments Example | |
// FunctionWithDefaltArgments – provide variations of the same function, some with default //arguments, by overloading the function name | |
using System; | |
namespace FunctionsWithDefaultArguments | |
{ | |
public class program | |
{ | |
public static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MixingFunctionsAndMethods – mixing class functions and object methods can class cause problems | |
using Systems; | |
namespace MixingFunctionsAndMethods | |
{ | |
public class Students | |
{ | |
public string sFirstName; | |
public string sLastName; | |
// InitStudent – initialize the student object | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open CSV file: | |
1. public Form1() | |
2. { | |
3. InitializeComponent(); | |
4. | |
5. OpenFileDialog dialog = new OpenFileDialog(); | |
6. dialog.Filter = "CSV Files (*.csv)|*.csv"; | |
7. if (dialog.ShowDialog() == DialogResult.OK) | |
8. { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ParseSequenceWithSplit – input a series of numbers separated by commas, parse them into integers //and output the sum | |
namespace ParseSequenceWithSplit | |
{ | |
using System; | |
class Program | |
{ | |
public static void Main(string) args) | |
{ | |
// prompt the user to input a sequence of numbers | |
Console.WriteLine(“Input a series of numbers separated by commas:”); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pass By Reference | |
using System; | |
namespace PassByValue | |
{ | |
public class Program | |
{ | |
// Update – try to modify the values of the arguments passed to it; note that you can declare | |
// functions in any order in a class | |
public static void Update(int I, double d) |
OlderNewer