We have been working very hard since 2009 to facilitate in learning Read More. We can't keep up without your support. Donate.

Please discuss

Views: 1245


Replies to This Discussion

bhai this is c# , as far as i think we use readline() function to take input from user , what u type is c++ .(cin). which will not run in  c# compiler 

koi to final solution upload kr do

change line cin >> userinput; with following your problem ressolve. but on page 2 another solution has been uploaded.

Console.Write("Hello, {0}", Console.ReadLine());


Do change variable name and array name... its a second question answer
and first question answer is already replied by our fellow just you add the reason is
readonly initilized only once we can't used with inilization of the object......... do search google
  1. Create ‘Names’ string array which will contain 10 elements. [2]

             String[] assignment = new String[10];


  1. Use For loop to get 10 names from user. [3]


for (int i = 0; i < 10; i++)


           Console.WriteLine("Please write 10 Name one by one and press enter");

            assignment [i] = Console.ReadLine();




c. Print Names array using foreach loop. [2.5]

        foreach (string asgn in assignment)





d. Get a name and index from user. And replace the name on index (given by

user) with the new name. [5]

Console.WriteLine("Enter Name to replace :");

        String tempname = Console.ReadLine();

        Console.WriteLine("Enter index to replace with :");

        String temp = Console.ReadLine();


            int index = Convert.ToInt32(temp);


                assignment [index] = tempname;

            Console.WriteLine(assignment [index]);



e. Now use while loop to print the Names array. [2.5]

            int a = 0;

            while (a < 10)


                Console.WriteLine(assignment [a]);



Jazakallah Hu Khair. please confirm have your done all with this code? i am gonna do that but possibly will be needed your help

Tested successfully but in the last after showing replaced index console window go close automatically. but its ok


Allah Apko jaza e khair daey.


will you please upload screen shoot ?

why needed screen shot. question 2 ka answer sahi hai,, ap variable name change karen aur use karlaen apnaey assignment maen koi syntax ya logical error nahi hai.

Uploading Instructions:
• Your assignment must be in MS Word format.
• Use this compiler http://ideone.com/ , to compile your code section.
• First paste your code and then paste screen shot of your compiled code.
• Assignment will not be accepted through email.

Will you pleace write here the complete code?

In one compilation form.

Please give me the complete code which need compilation only.

I am confused with these parts of code. where to write which part of code.

Time is too short as you know.



© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service